category pages

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Sridhar Katakam 10 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #77269

    fred901
    Member

    Hi Everyone,

    Is it possible with genesis to make category pages show more posts than the blog homepage?

    Thanks
    Fred

    #77655

    Sridhar Katakam
    Participant
    Post count: 1048

    Yes.

    Add the following sample code in child theme’s functions.php:

    add_action( 'pre_get_posts', 'sk_change_category_pages_posts_per_page' );
    function sk_change_category_pages_posts_per_page( $query ) {
    	
    	if( $query->is_main_query() && !is_admin() && is_category( ) ) {
    		$query->set( 'posts_per_page', '18' );
    	}
    
    }

    Change 18 to the number of posts that should appear on category pages. If you want to show all available posts, set it to -1.

    Source: http://www.billerickson.net/customize-the-wordpress-query/


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.