I want to use one structure section for multiple menu's (navigations). So I want all pages under topmenu in the topmenu (header) and I want all pages in the bottommenu in a menu in the footer. How can I accomplish this most easily in my twig file? example of my structure lay-out

  • Not really a direct answer to your question, but for specialized menus I prefer using this plugin: github.com/am-impact/amnav
    – peirix
    Commented Jul 21, 2015 at 12:50
  • Hi Peirix, I know that plugin, but wanted to solve it native with Craft. I didn't want my users to do things on two places (first add content and then add it to a menu-item). Thanks for suggesting though! :-)
    – Tom Suter
    Commented Jul 22, 2015 at 6:13

1 Answer 1


This is something i've used, it should work for you, the only downside to it is there being a hardcoded id.

{% set nav = craft.entries.section('yourStructureSection') %}

{% set headerItems = nav.descendantOf(TopMenuId) %}

{% set footerItems = nav.descendantOf(BottomMenuId) %}

So you would just replace TopMenuId with the entry id of Topmenu and BottomMenuId with the entry id of Bottommenu

Then you will be able to loop through each nav :)


 {% nav entry in craft.entries.section('contentPages').descendantOf(13) %} 
    <li> <a href="{{ entry.url }}">{{ entry.title }} </a>
        {% ifchildren %}
            <ul> {% children %} </ul> 
        {% endifchildren %}
 {% endnav %}
  • Thanks Alec, good suggestion. I tried this, but didn't work completely. What am i doing wrong? {% set nav = craft.entries.section('contentPages') %} {% set headerItems = nav.descendantOf('topmenu') %} <nav> <ul> {% nav page in headerItems %} <li> <a href="{{ page.singleEntrySelector.first().url | default }}">{{ page.title }}</a> </li> </ul> </nav>
    – Tom Suter
    Commented Jul 21, 2015 at 13:15
  • It looks like where you have topmenu, this needs to be the numerical ID of the entry Commented Jul 21, 2015 at 13:16
  • I've updated my answer, it now has code based on your comment above, just a bit of refactoring. I can't see anything wrong with this snippet though? Are you missing an {% endblock %} or some other closing tag? Commented Jul 21, 2015 at 13:35
  • Awesome, no worries :) Commented Jul 21, 2015 at 13:45

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.