1

I want to render a menu with a container like this:

<nav class="nav">

However, the container is just rendering with the default class name applied which I don't want.

<nav class="menu-main-nav-container">

I can't understand where I'm going wrong. Here's my code:

if ( has_nav_menu( 'nav-menu' ) ) { 
wp_nav_menu( array( 
'theme_location' => 'nav-menu', 
'container' => 'nav', 
'container-class' => 'nav', 
'items_wrap' => '<ul id="%1$s" class="clearfix %2$s">%3$s</ul>' ) );
} 

Anyone able to help?

1
  • I have the same problem, container_class never appear.
    – Gino
    Commented Nov 19, 2016 at 17:55

1 Answer 1

0

You should use

'container_class' => 'nav', 

instead of

'container-class' => 'nav', 

You can check out the parameters here:

http://codex.wordpress.org/Function_Reference/wp_nav_menu

1
  • Thank you! Been a while since I did any PHP and I've been doing this all evening.
    – Steph
    Commented Mar 4, 2013 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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