0

Is there a way to add a condition like {if results} or {if empty} when searching for a category in a channel entry?

{if a category 41 is selected display}Category Group Name: {categories show_group="41"}{category_name} {/categories}{/if}

I have a number of category groups in my channel. When displaying the selections I want to first show a heading (category group name) then the selected categories. If nothing is selected I don't want anything to show.

I am testing: http://devot-ee.com/add-ons/jco-entry-catcount

{exp:jco_entry_catcount entry_id="{entry_id}" category_group_id="41":} {if nbrcategories > 0} Provincial Riding: {categories show_group="41"}{category_name} {/categories}
{/if} {/exp:jco_entry_catcount}

{exp:jco_entry_catcount entry_id="{entry_id}" category_group_id="39":} {if nbrcategories > 0} Federal Riding: {categories show_group="39"}{category_name} {/categories}
{/if} {/exp:jco_entry_catcount}

2

You should use GWCODE CATEGORIES (http://gwcode.com/add-ons/gwcode-categories/documentation)

something like:

{exp:gwcode_categories entry_id="{entry_id}" group_id="41"}
######
{/exp:gwcode_categories}
| improve this answer | |

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.