Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have been pouring through the code trying to find out how the navigation menu is actually built. In my header I see:

< nav id="site-navigation" class="main-navigation" role="navigation">
    < h3 class="menu-toggle">Menu< /h3>
    < a class="assistive-text" href="" title="Skip to content">Skip to content< /a>
    < div class="menu-main-menu-container">
        < ul id="menu-main-menu" class="nav-menu">
            < li id="menu-item-22" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-22">< a href="">< /a>
             < ul class="sub-menu">
               < li id="menu-item-314" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-314">< a href="">< /a>< /li>
               < li id="menu-item-123" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-123">< a href="">< /a>< /li>
            < /ul>
          < /li>
         < li id="menu-item-316" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-316"><a href=""></a>
      < ul class="sub-menu">

I'm mostly trying to figure out where the sub-menu comes from. I need to add a div inside the sub menu for some extra styling.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The code in question is in header.php, line 45.

<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>

This is the Codex reference to this function: wp_nav_menu.

From my experience, and some googling, this previous answer has the answer you're looking for.

If possible, would just adding a class to the sub-menus do the trick instead of adding a div? If so you should be able to just copy and paste the code from the above linked answer and then target the elements with CSS to get the effect you're after.

share|improve this answer

Your Answer

 
discard

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.