I am trying to build a custom menu walker and I am unclear on how I would be able to build a UL for top level menu items and a separate UL for all menu items of lower levels.
Essentially I am trying to output:
<ul class="first-level-links">
<li class="first-level-link" id="A">
<a href="#">first level link A</a>
</li>
<li class="first-level-link" id="B">
<a href="#">first level link B</a>
</li>
</ul>
<ul class="second-level-links-for-A">
<li class="second-level-link">
<p>second level link A.1</p>
<ul class="third-level-links">
<li class="third-level-link">third level link A.1.a</li>
</ul>
</li>
<li class="second-level-link">
<a href="#">second level link A.2</a>
</li>
</ul>
Example http://christopheryanceyis.me/test.php
Can I do this in a wordpress walker? If so, how?
I have encountered a number of potential solutions to this problem, one solution I have come across is to use a Walker as you suggested.
However in my experience all of the solutions have failed in one scenario or another. Common failures I have seen with different solutions that I have tried:
After dealing with this problem on numerous client websites, I finally set aside the time to build a proper split menu / secondary menu plugin for WordPress. My plugin doesn’t exhibit any of the faults that I have found with other solutions.
To use it you can either implement the widget (easy mode), or you can use the function in your templates wherever you would normally use wp_nav_menu (developer mode).
You can check it out here: https://mattkeys.me/products/wp-nav-plus/