Answer the question
In order to leave comments, you need to log in
How to write Walker_Nav_Menu class for menu sublists?
Help me write a class that will generate an adequate menu, namely:
let's say the menu structure is like this:
<ul>
<li>
<a></a>
</li>
<li>
<a></a>
<ul>
<li>
<a></a>
</li>
</ul>
</li>
</ul>
<ul class="main-menu">
<li class="menu-item">
<a class="menu-link"></a>
</li>
<li class="menu-item">
<a class="menu-link"></a>
<ul class="sub-menu">
<li class="menu-item-1">
<a class="menu-link-1"></a>
</li>
</ul>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
Walker class documentation for WP
As a ready-made example, you can look at wp-bootstrap-navwalker
Read, analyze, write. I don't have any ready-made code for such a task.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question