Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Dependent Sub Menus

Started by Muut Archive 12 years ago · 3 replies · 380 views
12 years ago

I'd like to have a second-level-menu which only changes when I click the corresponding parent element.

could you provide any code ?

thanks

12 years ago

{% for p in pages.children %}

TWIG
                {% if (p.active or p.activeChild) %}

                    {% for c in p.children %}

                        {% if (c.active) %}

                            <a class="active" href="{{ c.url }}">{{ c.title }}</a>

                        {% else %}

                            <a href="{{ c.url }}">{{ c.title }}</a>

                        {% endif %}

                    {% endfor %}

                {% endif %}

            {% endfor %}
12 years ago

this is what i figured out so far ! :D it works just perfectly :D i'm so proud i found it out myselt !

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2273 9 years ago
Archive · by Muut Archive, 9 years ago
2 1495 9 years ago
Archive · by Muut Archive, 9 years ago
2 4742 9 years ago
Archive · by Muut Archive, 9 years ago
1 3552 9 years ago
Archive · by Muut Archive, 9 years ago
3 1618 9 years ago