Wp_nav_menu() doesn't add class to ul element

Hi guys.

I have weird issue with WordPress, basically I want to add class to the UL element (I’m using Bootstrap), those are ways that I tried

    <div class="navbar menu-nav navbar-inverse navbar-static-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        <div class="navbar-collapse collapse">
        <?php wp_nav_menu( array(
			'theme_location' => 'primary',
			'items_wrap'      => '<ul class="nav navbar-nav menu">%3$s</ul>',
			'menu_class' => ''    			
		)); ?>

Second one, by using menu_class argument but It only add wrap ul with new div, with specified class

<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav navbar-nav menu' )); ?>

What I’m doing wrong ? Thanks.

1 Like


I didn’t check the “Primary menu” in WP Admin :grinning: :gun:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.