Thanks for the reply, but the function only reads the one value after the “=” in the query…Helpful would be some insight given to me by some WP-crack whether “AND” for ‘n’ cat queries is working at all or how it could be enabled..
The method that chuyskywalker described works but does an OR on the categories. So cat=11,12
would display posts from categories 11 or 12.
As far as I know, there isn’t a way to diplay only posts that belong to two specific categories. Are you sure you want what you’re asking for? This would be like asking for posts from “Football” and “Vacation” categories.
Well, a Select of post in two disjunct categories is quite important for my purposes. I am maintaining a business weblog and make very extensice use of categories. I have for instance news items that stem from a specific country, contain news of a specific supplier or contain business figures . Being able to use a .php?cat=n&cat=y&cat=z query would enable me (and others with a similar subject) to build a very interesting category-based search.
Thx for follow up
Try using a plus sign:
index.php?cat=11+12
Thanks for reading&replying, but I am afraid that does not work either…but thx anyway
in the top of you index.php, right after the notice about not removing these lines, try this:
if (!isset($cat)) {
$cat = "x,y";
}
Where x & y are the category numbers you do want shown.
See if that works for you.
TG
Hmmm…
I just tested mine (1.2) again and I can do
index.php?cat=2+3
or
index.php?cat=3+8+9+11
and it works perfectly.
Dennis
I just tried it, and it does not work for me, either. BTW: I’m very interested in having this feature because I use the blog engine as a sort of poor-man’s bug tracker. Consequently, I need ANDing of categories.
However, I don’t think I’m running the latest version, so that could be it…?
dooglio, using either
?cat=1,2,3
or
?cat=1+2+3
to combine category queries has worked from the start. Keep in mind if one of the queried categories has the lion’s share of recent posts, that can make it appear as if it doesn’t work.
Well, ?cat=1,2,3 and ?cat=1+2+3 does the same thing for me. And that’s not what he’s asking for.
I too need to be able to get the posts that belong to, say, both cat 2 and 7. I don’t want those that only has cat 2, or only cat 7, but those that has both.
Example:
Let’s say I have categories HOWTO (1) and GIMP (2) and AMAROK (3). Some posts are about GIMP or AMAROK in general, some are GIMP HOWTOs and some might also be AMAROK HOWTOs.
Now, what I want is GIMP HOWTOs. Asking for ?cat=1+2 gives me all GIMP postings and all HOWTO postings (including AMAROK stuff). How can I get just the postings belonging to both GIMP and HOWTO?