Exclude specific category posts except for stickies (4 posts)

  1. denutza
    Posted 3 years ago #

    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

  2. keesiemeijer
    Posted 3 years ago #

    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?

  3. denutza
    Posted 3 years ago #

    No other loops or queries before this.

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

  4. keesiemeijer
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.