[Resolved] How to show posts having both a specified category and tag applied
I am trying to create a modification to the post loop to show all posts having both a specified category and a specified tag applied. In other words, each post shown must have both applied; they can have more than both applied, but they must have at least both.
By way of example, if I ask for posts in the “recipe” category tagged as “pie,” I’m happy to get posts in the “recipe” category tagged as both “pie” and “dessert,” but not posts in the “recipe” category tagged only with “dessert.”
I found this in the codex that seems to handle a multiple-category AND request:
query_posts(array('category__and' => array(2,6)));
and this to handle a multiple-tag AND request:
Is there a way to adopt/combine this to show posts for a given category and tag? Or would it be easier to just use only categories or tags, not both? Note that this is a new blog, empty of content, and so structural decisions like this are fine atm.
As a second part to the question, can anyone suggest a way to create a call to this using a link so that I don’t have to create a static page for each result?
- The topic ‘[Resolved] How to show posts having both a specified category and tag applied’ is closed to new replies.