gpt4 book ai didi

css - Wordpress 自定义菜单小部件和 CSS 样式

转载 作者:行者123 更新时间:2023-11-28 10:18:53 25 4
gpt4 key购买 nike

当我通过小部件将自定义菜单添加到我的主题时,我得到了这行代码:

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

));

最佳答案

自定义菜单是(或应该)在您的 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
));

关于css - Wordpress 自定义菜单小部件和 CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14659586/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com