Last active
August 29, 2015 14:00
-
-
Save iainurquhart/11363859 to your computer and use it in GitHub Desktop.
Auto expanding navigation (Only siblings of parents displayed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set topEntry = craft.entries.depth(1).slug('about-us').first() %} | |
{% set parents = entry.getAncestors() %} | |
<ul> | |
{% nav item in topEntry.getDescendants() %} | |
{% set showChildren = false %} | |
{% for parentItems in parents %} | |
{% if parentItems.id == item.id or entry.id == item.id %} | |
{% set showChildren = true %} | |
{% endif %} | |
{% endfor %} | |
<li class="level_{{ item.depth }}">{{ item.link }} | |
{# fine #} | |
{% if showChildren %} | |
x | |
{% endif %} | |
{# shits itself here #} | |
{% if showChildren %} | |
{% ifchildren %} | |
<ul>{% children %}</ul> | |
{% endifchildren %} | |
{% endif %} | |
</li> | |
{% endnav %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment