Does anyone know if its possible to use a category ID inside an {if} conditional.
Ideally I would like to say something along the lines of:
{if category_id == "1"}
content
{/if}
Let me know your thoughts -
Many thanks -
James
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
May 15, 2011 2:12pm
Subscribe [5]#1 / May 15, 2011 2:12pm
Does anyone know if its possible to use a category ID inside an {if} conditional.
Ideally I would like to say something along the lines of:
{if category_id == "1"}
content
{/if}
Let me know your thoughts -
Many thanks -
James
#2 / May 16, 2011 6:20am
James,
It sure is. Make sure it is wrapped in the {categories} tag pair first though if using inside the {exp:channel:entries} tag
{exp:channel:entries channel="blog" limit="10"}
{categories}
{if category_id == "1"}
content
{/if}
{/categories}
{/exp:channel:entries}Does that help?
#3 / May 20, 2011 5:34pm
Brilliant! That worked for me too. Thanks so much! And great forums, I found the answer quickly.
#4 / May 21, 2011 1:59pm
Hi Cure Studio,
Did John Henry’s advice help you out with this?
Cheers
Greg
@focusfusion, glad that you found this useful.