2013-02-02 53 views
3

當我通過一個小部件添加自定義菜單,我的主題我得到這行代碼:WordPress的自定義菜單控件和CSS樣式

<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> 

我需要刪除class="menu",但我可以不知道在我使用小部件時,這是如何添加到我的自定義菜單中的。這種風格是在我的主題中創建風格問題。

如何從此小工具中刪除class="menu"

我的註冊欄是這樣的,我不知道這是否是做什麼的,或者如果WordPress的代碼看起來CSS樣式菜單,當您使用自定義菜單窗口小部件:

 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>', 

)); 

回答

1

自定義菜單(或應該)在你的內部創建functions.php。找到這樣一段代碼,並檢查或添加menu_class參數,並設置爲""

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 
)); 
+0

他使用小部件,而不是硬編碼的菜單。 – Libertardian