WordPress.org

Support

Support » How-To and Troubleshooting » Exclude Posts *NOT* Child of specific Category that is assigned to Current Post.

Exclude Posts *NOT* Child of specific Category that is assigned to Current Post.

  • Newbie question I am sure: I have been raking the forums and web for days now trying to figure this out. All of the Category handling for WP_Query assumes you are either wanting to include posts from specific category or exclude posts from other categories, but what I really need to be able to do is tell it to exclude all posts that are not the Child of a specific category that is currently assigned to the post.

    Let me explain what I am working on. We have a web site that is supposed to display Posts in a “Journal” format – Each Journal has its own Issue and there are a number of Post “Articles” rolled up under each Issue. I have a Journal page that shows all Articles, but when you click on the Article single post page, I am trying to display the other Post/Articles in the same Issue.

    The Category tree for this looks like:

    – Journal
    — Issues
    — Issue 01
    — Issue 02
    — Etc.

    On the single article/post page, I need some basic logic to check to see which “Issue” the current post belongs to – i.e. “Issue 01” – and then pull all the articles from this same Issue category to display in the “In this Issue” display at the top of the page.

    Help please?

  • The topic ‘Exclude Posts *NOT* Child of specific Category that is assigned to Current Post.’ is closed to new replies.
Skip to toolbar