Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: Trouble with categories group_id
Status | Resolved |
Add-on / Version | Publisher 2.11.1 |
Severity | |
EE Version | 5.2.6 |
Werner Gusset
Aug 08, 2019I rebuild part of an old site and get in trouble with a conditional around categories and group_id.
This is the code that works on an old non Publisher site
{exp:channel:entries channel=....}
{categories show_group="2"}
{if category_id == "11"}
<i class="far fa-file-video"></i> {category_name}
{if:else}
<i class="far fa-file-pdf"></i> {category_name}
{/if}
{/categories}
{exp:channel:entries}
and this on the new Publisher site does not work. It outputs template code after the opening exp:publisher:translate_category tag
{exp:channel:entries ...}
{exp:publisher:translate_category group_id="2"}
{if cat_id == "11"}
<i class="far fa-file-video"></i> {cat_name}
{if:else}
<i class="far fa-file-pdf"></i> {cat_name}
{/if}
{/exp:publisher:translate_category}
{/exp:channel:entries}
What have I done wrong?
Werner Gusset
Maybe need to add that there are 3 category groups in that channel.
BoldMinded (Brian)
Try adding a var prefix, it’s probably confused when parsing the variables.
Werner Gusset
I have this
The conditional does not work. Gets the icon from the else part. It outputs “{cat:cat_name}”
BoldMinded (Brian)
Does it work if you don’t use the conditional?
Werner Gusset
It ouputs “{cat:cat_name}”
I suspect the parameter group_id=”2”. This is not mentioned in your doc.
BoldMinded (Brian)
Yeah, group_id is not a valid parameter, it should be cat_id.
BTW, I have a very similar template tag in one of my production sites and it parses correctly, so I don’t think there is a bug here. Try the cat_id parameter.
Werner Gusset
And what exactly would I try?
Werner Gusset
I don’t know the cat_id. Or should I put all cat_ids from group_2 in there?
BoldMinded (Brian)
You need to know the category id, that is the only way that tag works.
BoldMinded (Brian)
Usually that tag is used inside of a categories tag pair of some sort, or you know the category id and hardcode the cat_id parameter. I should have realized sooner that group_id is not a valid parameter.
Werner Gusset
Good Brian
I missunderstood the tags functionality. The code that solved my problem is:
Thank you.
BoldMinded (Brian)
Cool, glad we figured it out 😊