Custom Wordpress Menu Widget and CSS Styling

When I add a custom menu to my theme via a widget, I get this line of code:

<ul id="menu-insurance" class="menu"><li id="menu-item-294" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-294"><a href="http://test">test</a></li>

      

I need to remove class="menu"

, but I can't figure out how this gets added to my custom menu when I use the widget. This style creates style problems in my theme.

How to remove class="menu"

from this widget?

My sidebar in case looks like this, I'm not sure if it does it, or if the Wordpress code looks for the CSS style for the menu when you use the custom menu widget:

     register_sidebar(array(
    'id' => 'sidebar',
    'name' => __('Main Sidebar'),
    'description' => __('Sidebar used on most pages'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',

));

      

+3


source to share


1 answer


Custom menus are created (or should be) functions.php

inside yours. Find a piece of code like this and check or add a parameter menu_class

and set to ""

.



wp_nav_menu(array(
    'container' => false,                           // remove nav container
    'container_class' => 'menu clearfix',           // class of container 
    'menu' => 'The Main Menu',                      // nav name
    'menu_class' => 'top-nav clearfix',             // This is it!!!
    'theme_location' => 'main-nav',                 
    'before' => '',                                 // before the menu
    'after' => '',                                  // after the menu
    'link_before' => '',                            // before each link
    'link_after' => '',                             // after each link
    'depth' => 0,                                   // limit the depth of the nav
    'show_home'   => '1',                           // show home link
    'fallback_cb' => 'bones_main_nav_fallback'      // fallback function
));

      

+1


source







All Articles