• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Author Pro – Display Series Books All On One Page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Author Pro – Display Series Books All On One Page

This topic is: not resolved

Tagged: Author Pro, books, post count, series

  • This topic has 1 reply, 1 voice, and was last updated 7 years, 5 months ago by killyman.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • August 10, 2015 at 10:56 am #161951
    killyman
    Member

    Hi All,

    When viewing books via the Series filter option, I want all the books to show on the page and not be limited by what number of posts is set in Settings > Reading (Blog pages show at most #).

    I don't want the visitor to have to navigate to page 2, 3 and etc. to see all the books in a specific "Series".

    For my primary Books page (where all books are shown LINK http://delphiniumbooks.com/cms/books/), I added the following to the functions.php file which overrides the limit in Settings > Reading (Blog pages show at most #).

    add_action( 'pre_get_posts', 'cpt_archive_items_limit' );
    function cpt_archive_items_limit( $query ) {
    	if( $query->is_main_query() && ! is_admin() && is_post_type_archive( 'books' ) ) {
    		$query->set( 'posts_per_page', '100' );
    	}
    }
    

    Does anyone know what code I need to add to the functions.php file to get all the Series pages to show the full number of books on one page in each Series, thus overriding what the post count is set to in the Settings > Reading (Blog pages show at most #) area?

    LINKS TO SAMPLE BOOK SERIES PAGES
    FICTION: http://delphiniumbooks.com/cms/series/fiction/
    NONFICTION: http://delphiniumbooks.com/cms/series/nonfiction/
    NOVEL: http://delphiniumbooks.com/cms/series/novel/
    and so forth...

    http://delphiniumbooks.com/cms/
    August 12, 2015 at 12:11 am #162121
    killyman
    Member

    SOLVED!

    I finally figured it out after a bit more persistence. Just in case anyone else is trying to accomplish the same thing.

    I added the following to my Author Pro's functions.php file.

    add_action( 'pre_get_posts', 'change_book_posts_per_book_series_page' );
    
    function change_book_posts_per_book_series_page( $query ) {
    	
    	if ( $query->is_tax( 'book-series' ) && $query->is_main_query() ) {
    		$query->set( 'posts_per_page', '100' );
    	}
    
    }

    The key was this line of code which I had to make sure to reference is_tax and then book-series.

    if ( $query->is_tax( 'book-series' ) && $query->is_main_query() ) {
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble