CSS Classes (optional) on menu is not showing

As you know, there are input boxes for CSS Classes (optional) on each menus.

But it’s not showing (coming out) in source.
Is there any function for disable for CSS Classes (optional)?
I need to find it and remove it.

Read More

my another sites work fine like this. I put “navi_box1” on Menu1 as CSS Class. and it shows right spot..
<ul id="menu-menu-box" class="menu"><li id="menu-item-422" class="navi_box1 menu-item menu-item-type-custom menu-item-object-custom menu-item-422"><a href="/" class="has-submenu">Menu1</a>
..........etc.......
</ul>

this is the codes for navi..

    wp_nav_menu( array( 'container' => false, 'menu_class' => 'left', 'theme_location' => 'primary', 'fallback_cb' => 'sweetdate_main_nav', 'walker'        => new sweetdate_walker_nav_menu) );

the name of theme_location is right.

Related posts

3 comments

  1. The obvious answer is that sweetdate_walker_nav_menu, which is the walker that creates this menu, is written is such a way as to not print those classes. It is hard to say for sure without seeing the code for that custom walker but you can remove the 'walker' => new sweetdate_walker_nav_menu argument to verify that that is the problem. If it is you’d have to write code into the walker so that it uses those classes.

    There is also a filter called nav_menu_css_class which I believe is what one would use to remove those classes. However, there are numerous other filters in nav-menu-template.php and nav-menu.php that could potentially be involved.

  2. You can use below code to your wp_nav_menu

    'items_wrap' => '<ul class="%2$s">%3$s</ul>'
    
  3. It is sometimes caused by some plugin, but you can edit it on live preview, on live editing customizer page:

    Customizer -> Menu * &setting

Comments are closed.