2

Looking at the docs, i can see that the category {% nav %} loop uses the categoryGroup as the starting point. But, i want the first top level category within the category group as the starting point.

So, i want to do something like:

{% set categories = craft.categories.slug('my-first-top-level-cat).first().getChildren() %}

{% nav category in categories %}
<ul>
    <li>
        {{ category.title }}
    </li>
</ul>
 {% ifchildren %}

   {% children %}

 {% endifchildren %}
{% endnav %}

But, doing this only returns the top level, no sub levels.

Also, i want to be able to limit the amount of children output as the there are a few sub trees.

3

i did {% set categories = craft.categories.descendantOf(1066) %}

And then i did

{% nav category in categories.level(2) %} {% endnav %}

Always get the answer myself just after i post these damn things.

  • Yep that's the way to do it :) You could also have set the level param on the initial {% set categories ... line. – Brandon Kelly Jun 24 '15 at 16:04

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.