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 was able to use <?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => false ) ); ?> to create the menu within my theme. Messed around with 'items_wrap' but couldn't get it to display correctly.

I need to add an image and container div into the sub menu ul before the li's. This is the structure I want:

    <ul id="nav">
    <li><a href="#">Page</a>
            <img src="<?php bloginfo('template_directory'); ?>/images/nav_ul_tab.png" class="nav_ul_tab" />
            <div class="nav_spacer">
                <li><a href="#">Sub Page</a></li>
                <li><a href="#">Sub Page</a></li>
                <li><a href="#">Sub Page</a></li>
share|improve this question

What you want is invalid markup. The only children an ul can have are li. Use CSS instead:

#nav ul
    padding-top:    40px; /* Your image size. */
    background:     url(/path/to/your/image/img.png) top center no-repeat transparent;
share|improve this answer
I have a set width and a height of 100% on that image as a hacked background image to size as the menu drop down grows. I guess its best to just figure out another solution. Thanks for the answer. – Luke May 4 '11 at 3:16

We can insert the image via Jquery. Here is the code. Before execute this code make sure JQuery JavaScript should be load in your page.

<script type="text/javascript">
        jQuery("#nav li ul .nav_spacer").before('<img src="<?php bloginfo('template_directory'); ?>/images/nav_ul_tab.png" class="nav_ul_tab" />')
share|improve this answer

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.