Sub navigation problem

andrew's Avatar

andrew

06 Mar, 2017 05:07 PM

Hi, could I please have your help getting the code right for sub navigation? I would like to display the navigation for sibling entries only. Or, if the parent has children, display the children instead. The structure of the site contains a variation of depths, which means I'm struggling to find the right code. I've included a PDF with a simplified navigation tree.

  1. 1 Posted by andrew on 06 Mar, 2017 05:33 PM

    andrew's Avatar

    This is the code I've got so far:

    {if "{structure:child_ids}"}
        
        Children
        
    {if:else}

    {if segment_4!=""}
    {exp:structure:nav start_from="/{segment_1}/{segment_2}/{segment_3}" show_overview="yes" rename_overview="{structure:parent:title}"}
    {/if}

    {if segment_4==""}
    {exp:structure:nav start_from="/{segment_1}/{segment_2}" show_overview="yes" rename_overview="{structure:parent:title}"}
    {/if}

    {/if}

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Sub_navigation.png 32.3 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac