• Basically I want to create a dropdown menu, and I intend to do it by using only CSS. The problem is that the wp_nav_menu function is outputting this markup:

    wp_nav_menu( array(
      'theme_location' => 'home_menu',
       'before' => '<li>',
      'after' => '</li>'
    ));

    outputs

    <ul>
      <li><a>Menu Item 1</a></li>
      <li><a>Menu Item 2</a></li>
      <li><a>Parent Menu Item</a></li>
      <ul class="sub-menu">
        <li><a>Child Item 1</a></li>
        <li><a>Child Item 2</a></li>
      </ul>
    </ul>

    This is no good for me cause I need the ul.sub-menu list to be inside the parent’s li.

    I have googled examples of wp_nav_menu usage, and it seems it should wrap the sub menus inside their parents… I’m trying to figure out why this isn’t the case for me.. it’s driving me nuts!

    Also, I’m not sure whether this is related to this, but if I remove the “after” and “before” options, the menu items are not outputted.

    If I use this code:
    wp_nav_menu( array( 'theme_location' => 'home_menu' ));

    I get this output:
    <ul id="menu-other-pages-menu" class="menu"></ul>

    This shouldn’t be happening either right?

    Thanks for your help ??

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_nav_menu not working properly’ is closed to new replies.