Forums

different posts per page for categorys (2 posts)

  1. jonathantopf
    Member
    Posted 3 years ago #

    hey there, is there a way to get different amount of posts per page for separate categories? actually i only need a way of showing all the posts when i choose a certain category. I assume ther eis some code i need to put in to the loop for that categorys page, i just cant figure out what

    thanks

  2. stvwlf
    Member
    Posted 3 years ago #

    hi - you can add a query_posts command in an if statement before the loop in category.php

    <?php if(is_category('7')) {
       query_posts('posts_per_page=5');
    } else if(is_category('9')) {
       query_posts('posts_per_page=3');
    }

    Any categories not in your list would show the default # of posts per page.

    =========== loop starts here =============

    take a look at the query_posts codes page
    http://codex.wordpress.org/Template_Tags/query_posts

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.