WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 class="first-level-link" id="B">
            <a href="#">first level link B</a>

<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>
    <li class="second-level-link">
        <a href="#">second level link A.2</a>

Example http://christopheryanceyis.me/test.php

Can I do this in a wordpress walker? If so, how?

share|improve this question

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:

  • Secondary / Lower Level menus disappear when clicking into blog posts
  • Being forced to specify the parent menu item on each page that I show the split menu on
  • Solutions that rely on the page hierarchy, not the hierarchy in the menu manager

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/

share|improve this answer
Forgot to mention, here is a link to a walker that some people have used. helperclass.blogspot.com/2011/11/… – Matt Keys Jun 25 '13 at 0:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.