WordPress.org

Ready to get started?Download WordPress

Forums

show posts that are in more than one category (2 posts)

  1. noyz319
    Member
    Posted 7 years ago #

    Hi, the site i'm working on is a magazine site organized by issues. What i'm trying to do is create a table of contents for each issue.

    I have thing setup so each post is in one or more of the following categories:

    > EDUCATION
    – People
    – Books
    > MUSIC
    – Interviews
    – Reviews
    > FASHION
    > PODCASTS

    I also have a category called "ISSUE" with sub-categories 001, 002, 003, etc.

    I can't figure out how to make an archive page that would display like this:

    ISSUE 001 Table of Contents:

    > EDUCATION
    – show only posts that are in issue 001
    > MUSIC
    – show only posts that are in issue 001
    > FASHION
    – show only posts that are in issue 001
    > PODCASTS
    – show only posts that are in issue 001

    Has anybody had the same sort of problem before or know of a solution? I've tried using query_posts, but i could only manage to show posts that are in either cat 'A' or 'B', i couldn't get it to show posts that are in both 'A' and 'B'. Hopefully i worded this so it makes sense.

  2. seluna
    Member
    Posted 7 years ago #

    I have the same problem too, except mine is a lot more complicated, because mine involves using the category hierarchy itself.

    Basically what I do is that, I make it [ query_posts ] for one category. Let's say... A. Then I use [ if ] condition and, in your case, maybe [ in_category('category_id') ] to pick out those that are also in B and only display them. I actually use [ continue; ] with [ if ] but I haven't touch this code for some time so I'm not sure if it's necessary or not.

    It may not work, but it's worth a try. ^^;;

Topic Closed

This topic has been closed to new replies.

About this Topic