category_id in IF statement when entry has multiple categories

March 02, 2015 3:54pm

Subscribe [1]
  • #1 / Mar 02, 2015 3:54pm

    lelkins001's avatar


    9 posts

    this code has worked great for a long time. I pull entries and use an IF statement around which category they are in:

    {exp:channel:entries channel="resources" dynamic="on" limit="1"} {if "{categories}{category_id}{/categories}” == “44” OR “{categories}{category_id}{/categories}” == “191” } …. {/if} {if "{categories}{category_id}{/categories}” == “45”} …. {/if}

    All was good until I got an entry with more than one category (84&191;). The output is {category_id} = “84191” which doesn’t get caught in my conditional.

    I don’t want to use the “contains” conditional b/c then an entry with category 84 & 4 would be “844” and would match me looking for category=44. How do I solve this??


.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases