Support » Fixing WordPress » Exclude specific category posts except for stickies

  • Have not been able to find this specific answer through extensive searching.

    In my main home page loop, I want to exclude a category of posts, except if a post in that category is a sticky!

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

    That will exclude all the posts in the category.

    So the logic would be:exclude if category=6 AND !sticky

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    I just tested this query and the sticky posts from category 6 are still showing on top of all other posts (without category 6). Do you have any loops before the main loop?

    No other loops or queries before this.

    I would think that’s odd yours even showed the stickies, without additional code.

    Moderator keesiemeijer

    (@keesiemeijer)

    moderator

    Is this on a static front page?

    Can you paste and submit the full code into a pastebin.com and post the link to it here? see the Forum Rules for posting code and using the pastebin.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude specific category posts except for stickies’ is closed to new replies.