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?

  • I have the same problem, container_class never appear. – Gino Nov 19 '16 at 17:55
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

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

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.