I want to set a condition for category in exp channel tag which should result in a condition: "where category = 3 and category=2" How can I give this condition in exp? "category=3&2 " and category="3|2" not getting the correct results,they return the same query If anyone knows, please help.

Many Thanks


You'll want to use something like this:

{exp:channel:entries channel="your_channel" category_group="your_cat_group" category="2&3" dynamic="no"}

My understanding of it is as follows:

"2&3" - This returns all entries which are tagged as belonging to 2 AND 3.

"2|3" - This returns all entries which are tagged either 2 or 3.

So, the first will only return entries that have both categories set and the latter will get all categories where both are set OR only one of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.