Created
April 28, 2014 21:48
-
-
Save iainurquhart/11385028 to your computer and use it in GitHub Desktop.
active and active_parent classes to navigation
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 isParent = false %} | |
{% for parentItems in parents %} | |
{% if parentItems.id == item.id %} | |
{% set isParent = true %} | |
{% endif %} | |
{% endfor %} | |
<li class="level_{{ item.depth }}{% if isParent %} active_parent{% endif %}{% if entry.id == item.id %} active{% endif %}">{{ item.link }} | |
{% ifchildren %} | |
<ul>{% children %}</ul> | |
{% endifchildren %} | |
</li> | |
{% endnav %} | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment