0

I'm having a little issue which looks like a bug but probably isn't. Here we go:

I simply have this:

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

Now, my issue is that I expect my output to be:

<ul class="nav">
    <li>My link</li>
</ul>

instead I'm getting:

<div class="nav">
    <ul>
       <li>My Link</li>
    </ul>
</div>

I can't assign my nav class to the ul. How do I do that?

Many thanks!

  • Have you seen this answer? – fuxia May 11 '13 at 21:16
  • mmh, ok, I'm gonna have a look - but in the docs it says : $menu_class (string) (optional) The class that is applied to the ul element which encloses the menu items. Multiple classes can be separated with spaces. Formerly known as $wrap_class. Default: menu – alemur May 11 '13 at 21:21
  • There is also an argument 'container' that should be set to an empty string (example). You need it to change the … container. :) – fuxia May 11 '13 at 21:24
  • 3
    do you have a menu created and assigned to this location? – Milo May 11 '13 at 22:05
  • 1
    Yes, there is a bug. If you set a container false and use custom nav class, it will be setup on div. Remove 'container' => false,to set custom class on UL element. – Foxsk8 Sep 13 '16 at 18:54
0

As toscho pointed out the container argument should be left out or set to an empty string, and a menu should be created and assigned to the menu location (primary in this example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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