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

If I configure wp_nav_menu function, I can put the "items_wrap" option to achieve a nice navigation given by Twitter Bootstrap, thus: <ul class="nav nav-pills">%3$s</ul>. But, how to configure the custom menu widget to do the same? I mean, for achieve <ul class="nav nav-tabs nav-stacked">%3$s</ul> in all custom menu widgets, by default.

Thanks for help! Have a nice day.

share|improve this question
up vote 2 down vote accepted

Filter 'wp_nav_menu_args'.

add_filter( 'wp_nav_menu_args', 'wpse_79901_nav_menu' );

function wpse_79901_nav_menu( $args )
    $args['items_wrap'] = '<ul class="nav nav-pills">%3$s</ul>';
    return $args;
share|improve this answer
Great! But that would affect all existing item_wrap of each wp_menu_nav() defined and I just want to change item_wrap to custom menu widget ... I decided to make the following, tell me if it's the best way to do it: if(!$args['fallback_cb']){ $args['items_wrap'] = '<ul class="nav nav-pills">%3$s</ul>'; } return $args;. Works for me, but I don't know if it's the best way to do it. – Marco Godínez Jan 10 '13 at 5:47
@markotom That’s exactly how it should be done. :) – toscho Jan 10 '13 at 10:45
Nice, thanks for help me! – Marco Godínez Jan 11 '13 at 5:00

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.