php - How to use class on primary menu ul instead of div in wordpress -
i used php coding in wordpress primary menu.
<?php wp_nav_menu( array( 'menu' => 'top menu', 'theme_location' => 'primary', 'depth' => 2, 'menu_class' => 'nav navbar-nav', )); ?>
this output in preview.
<div class="nav navbar-nav"> <ul> <li class="active"><a href="#"> news <span class="sr-only">(current)</span></a></li> <li><a href="#">funny pictures</a></li> <li><a href="#">funny videos</a></li> <li><a href="#">goverment jobs</a></li> <li><a href="#">health</a></li> <li><a href="#">best shoping deal</a></li> </ul> </div>
this should work below, not above. please explain change need made in php code.
<div> <ul class="nav navbar-nav"> <li class="active"><a href="#"> news <span class="sr-only">(current)</span></a></li> <li><a href="#">test</a></li> </ul> </div>
look @ wordpress documentation states things need .
<?php $defaults = array( 'theme_location' => '', 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', 'depth' => 0, 'walker' => '' ); wp_nav_menu( $defaults ); ?>
i didn't understand question have understood may use container class add class div folder , menu_class add class name ul element .
Comments
Post a Comment