WordPress.org

Support

Support » How-To and Troubleshooting » How to combine these two queries?

How to combine these two queries?

  • Benjamin_SP
    Member

    @benjamin_sp

    I have this query at the start of my index.php:

    <?php query_posts($query_string . '&cat=-5'); ?>

    It prevents displaying of posts from the category with the id “5” from showing in the homepage.

    I also have this query:

    <?php query_posts('showposts=6'); ?>

    It shows only 6 posts on the homepage (a number different from the one I chose under “Blog posts show at most” in Settings >> Reading. This is because I need 20 posts to show in my archive and category pages and only 6 on the homepage.

    Problem is, either one of these two tags work – not both. If I put both together everything falls apart. I don’t get 6 posts and the pagination and everything breaks. Can these two queries be combined in any way to work together?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to combine these two queries?’ is closed to new replies.