Getting posts
-
Hi,
Forgive my question if it’s covered elsewhere, but I cannot find a solution to it, so far …
Let’s say I have two categories: A and B
Let’s also say that I have 3 items in category A and 10 items in category B … because I do.
Finally let’s say I have 2 items that are assigned to both categories A and B (also true)I can get all items from category A or all items from category B or all items from both categories A & B no problem. I’ve been able to accomplish this by using:
query_posts( array ( 'category_name' => $category ) )
OR$both = (A, B) query_posts( array ( 'category__and' => $both ) )Here’s where I’m having trouble:
I want to get all 3 items that are in category A and both items that are in category B … but NOT the 10 items that are in only category B — resulting in 5 items returned. As a converse, I also want to be able to get all 10 items in category B as well as both items that are in category A & B … but NOT the 3 items that are in only category A — resulting in 12 items returned.How can I accomplish this?
The topic ‘Getting posts’ is closed to new replies.