WordPress.org

Ready to get started?Download WordPress

Forums

Posts common to two or more categories (7 posts)

  1. subirghosh
    Member
    Posted 7 years ago #

    Is there a way to display posts that are common to two or more categories?

    I use this

    query_posts('cat=2,4,6,8');

    to display posts that belong to either/or all these categories.

    In a certain section, I want to display items which are common to ALL these four categories.

    Can this be done with query_posts?

  2. subirghosh
    Member
    Posted 7 years ago #

    Any clues, anyone?

  3. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    Conditional tags:
    if ( in_category(2) && in_category(4) && in_category(6) ... etc. after the foreach?

  4. subirghosh
    Member
    Posted 7 years ago #

    Thanks azaozz I will check it out. Will post the feedback here so that I can be of use to others too.

  5. siounis
    Member
    Posted 7 years ago #

    doesn't work yo

    real curious about all this.

  6. maxblast
    Member
    Posted 7 years ago #

    Did you guys figure something out to solve that problem? same problem here!

  7. siounis
    Member
    Posted 7 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic