0

With the category parameter in ExpressionEngine we can specify to not provide entries with a specific category category="not 1"

Is there a way to show entries that only have a specified category, for example: category="only 1"

So entries that are marked as category 1+2 will not show.

1
  • Good question. Are you asking in regard to the channel:entries tag or any tag? There is a very similar question here, and good info in the accepted (& other) answers: expressionengine.stackexchange.com/questions/5505/… I don't believe there are any native or non-work-around ways to do this. It's a pain. You could try a query or look for an add-on which does it. Commented Jul 16, 2014 at 22:07

1 Answer 1

4

This may be a little bit of a rough work around but it should work for you.

Then you can use the "Entry Category Count" plugin and then run a conditional inside of your entries tag like the following:

{exp:channel:entries channel="foo" category="1"}
    {if {exp:entry_category_count entry_id="{entry_id}"} == "1"}
        ...
    {/if} 
{/exp:channel:entries}

Entry Category Count

On GitHub

3
  • 1
    Thanks, that looks like it would work - but it also looks as though would be pretty intensive performance wise. My question is purely hypothetical, so I'll wait to see what others come up with too.
    – Mutual
    Commented Jul 16, 2014 at 15:31
  • Yep totally understand, "rough" may be an understatement lol :)
    – ryandoss
    Commented Jul 16, 2014 at 15:41
  • Haven't seen this approach before - good one! Commented Jul 16, 2014 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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