WordPress.org

Ready to get started?Download WordPress

Forums

Category pages override "Blog pages show at most". Possible? (3 posts)

  1. Matt
    Member
    Posted 2 years ago #

    Going to a category page shows the same number of posts as the "Blog pages show at most" setting.

    How can I make them show n number of posts, or all posts in a category?

    thx
    I

  2. jmoseley
    Member
    Posted 2 years ago #

    If you edit the category.php template file you can do a custom query to get back exactly the number of posts you want. You would put this code just before the loop.

    Get back 10 posts from current category
    query_posts( array ( 'category_name' => single_cat_title( '', false ), 'posts_per_page' => 10 ) );

    Get back all posts from current category
    query_posts( array ( 'category_name' => single_cat_title( '', false ), 'posts_per_page' => -1 ) );

  3. Matt
    Member
    Posted 2 years ago #

    Thank you, J. Problem is, I'm using Twenty Ten theme with a loop-category.php driving category.php. I've tried putting your code here and there and it hasn't worked.

Topic Closed

This topic has been closed to new replies.

About this Topic