Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Dependent Sub Menus

Started by Muut Archive 11 years ago · 3 replies · 279 views
11 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

11 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 %}
11 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 1322 9 years ago
Archive · by Muut Archive, 9 years ago
2 918 9 years ago
Archive · by Muut Archive, 9 years ago
2 4048 9 years ago
Archive · by Muut Archive, 9 years ago
1 2922 9 years ago
Archive · by Muut Archive, 9 years ago
3 1106 9 years ago