1

The documentation shows how to put a sub-nav on a parent page with children, but how do I display the same sub-nav on the child pages? http://buildwithstructure.com/documentation/conditionally_display_sub_navigation_or_html/

1

You can use additional or statements to check if you're past or at a certain segment if you want to show it as you go down. Otherwise, sometimes it's easier to use different templates for pages you do or do not want to show it.

| improve this answer | |
  • 1
    I got it working with the structure:parent:entry_id global variable {if structure:child_ids != '' OR structure:parent:entry_id != 0} – Christy Collins Mar 22 '15 at 20:53
1

I display the menu in an embed with the parent template passing the relevant Entry IDs to display. So using this conditional:

{if "{structure:child_ids}"}
    {structure:child_ids}
{if:else}
    {exp:structure:entries parent_id="{structure:parent:entry_id}" backspace="1"}
        {entry_id}|
    {/exp:structure:entries}
{/if}

If child page exist, render out the entry IDs of the children, otherwise when you're in one of the child pages, get the parents children.

Putting it together:

{embed="block-embeds/.hub-nav" menu_entries="{if "{structure:child_ids}"}{structure:child_ids}{if:else}{exp:structure:entries parent_id="{structure:parent:entry_id}" backspace="1"}{entry_id}|{/exp:structure:entries}{/if}"}

Then on the child template I have this channel entries call:

{exp:channel:entries
    channel="content"
    dynamic="no"
    fixed_order="{embed:menu_entries}"
    disable="member_data|pagination"}
| improve this answer | |

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.