I have 2 Main Groups of Categories, which themselves have Sub-Categories.
The Categories you see have checkboxes to filter entries below.
One Sub-Group has also Children (With Material/ Without Material) ->Screenshot.
I need to collapse these two groups (on click they open/close).
How can i target these Sub-sub-Category Groups?
Right now i use:

{% ifchildren %}
 <ul class="subcategory-list">
   {% children %}
{% endifchildren %}

enter image description here

I tried some with siblings but cannot get it to work. I also need to add extra html fot the arrow to indicate the collapse and to open the sublist.
If i add it right now, it gets added to all category-groups.

1 Answer 1


I'm not sure, but I think you might need to use level in your loop.

{% set categories = craft.categories.group('groupHandle').level(3) %}

{% for category in categories %}
    // etc
{% endfor %}

Have a look at the docs:


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.