The html

<div class="categorie"><b>Rechtsgebied:</b> {categories}{if "{parent_id}"=="10"}<i>{category_name}</i> {/if}{/categories}</div>

When I publish a new article, is it possible for me to hide the category on the website (so this piece of html) when all the categories are unchecked? Is this being done easily with an if statement?

I hope I'm being clear, if not, please ask

thanks :)

2 Answers 2


Maybe Stash addon can help here. This piece of code creates a Stash variables with the list of categories inside and then it only outputs it with the div class if the variable is not empty.

{exp:stash:set name="cats" parse_tags="yes"}{categories}{if "{parent_id}"=="10"}<i>{category_name}</i>{/if}{/categories}{/exp:stash:set}

{if {exp:stash:not_empty name="cats"}}
<div class="categorie"><b>Rechtsgebied:</b> 
  • Cool! And thanks, this almost helped. The only things is that it dóés remove the category, but on every entry (also the one's that have categories). Do you have any more experience with Stash? I can't find a solution in the docs.
    – Richie
    Feb 29, 2016 at 16:14

You can probably do what you want using Buzzing Pixel's Category Construct add-on. It is a very simple add-on that provides a raft of manipuation options for working with categories - including the ability to count how many categories are set for an entry (or collection of entries).

The actual EE code will depend on what else you are doing with your template, but you can find the (short, simple) documentation here:



  • Seems handy indeed. Unfortunately I got EE v2.5.2.. But I will certainly remember this add-on for in the future! It requires ExpressionEngine 3.0.0 or greater. :(
    – Richie
    Mar 1, 2016 at 8:20
  • Currently if you get the EE.3 version you get the EE 2 version as part of the same download. It is not very clear on their site, but I am using the EE2 version currently without problems... :) Mar 2, 2016 at 10:27

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.