Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Dependent Sub Menus

Started by Muut Archive 12 years ago · 3 replies · 410 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 2609 9 years ago
Archive · by Muut Archive, 9 years ago
2 1716 9 years ago
Archive · by Muut Archive, 9 years ago
2 5011 9 years ago
Archive · by Muut Archive, 9 years ago
1 3841 9 years ago
Archive · by Muut Archive, 9 years ago
3 1821 9 years ago