[resolved] showposts with a tweak (3 posts)

  1. cortex123
    Posted 2 years ago #


    I currently have this piece of code:

    <?php query_posts(array('showposts' => 4, 'cat' => $cat )); ?>

    it's at the homepage and it shows 4 posts for all categories. But there is one category that want to show 8 posts instead. What can I do to have one special category with 8 posts showing and the remaining ones with 4 posts?

    thanks in advance

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    You would need to use 2 queries and loops - the first using query_posts() and displaying (say) 8 posts from a specific category. The second would need to use WP_Query() and display 4 posts form every category except the previously displayed one.

  3. cortex123
    Posted 2 years ago #

    thanks for your answer, I've managed to make it happen :)

Topic Closed

This topic has been closed to new replies.

About this Topic