我在模板中添加了三个菜单,但在显示样式时遇到问题,无法为它们指定样式。以下是三个菜单:
function register_the_menu(){
register_nav_menus( array(
'header_menu_fadev' => __( 'HeaderMenu', 'fadev'),
'top_menu_fadev' => __( 'TopMenu', 'fadev' ),
'footer_menu_fadev' => __( 'FooterMenu', 'fadev' ),
) );
}
add_action( 'after_setup_theme', 'register_the_menu');
菜单1(带下拉菜单的页眉菜单):
<nav class="header__nav">
<ul class="align-items-center d-flex">
<li class="nav-item dropdown mx-2">
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown"href="#" role="button" aria expanded="false">Home</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
</ul>
</li>
<li class="mx-2"> <a href="#">Advertise</a> </li>
</ul>
</nav>
菜单2-3(上下菜单):
<nav class="section__left__nav">
<ul class="align-items-center d-flex flex-wrap">
<li class="mx-2 my-2 my-lg-0"> <a href="#" class="text-white">Home</a></li>
</ul>
</nav>
我不能使用我定义的样式。你能告诉我如何解决这个问题吗?
if (has_nav_menu('top_menu')) {
wp_nav_menu(
array(
theme_location' => 'footer_menu',
'menu_id' => 'menu-1',
'items_wrap' => '<ul class="align-items-center d-flex flex-wrap"><li class="mx-2 my-2 my-lg-0"><a class="text-white">%3$s</a></li></ul>',
'fallback_cb' => false,
)
);
}
1条答案
按热度按时间7rfyedvj1#
在
register_nav_menus
中,您定义了如下页脚菜单:在
wp_nav_menu
fortheme_location
中,您应该将参数更改为