我正在尝试从 HTML 结构为我的自定义 wordpress 主题创建一个菜单,但它似乎比我想象的要复杂得多,我现在设法得到这个结构,但其余的我被卡住了。你能帮我完成我的代码吗?
这是我想要实现的 HTML 结构:
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav">
<li class="dropdown"><!---- begin of features ------>
<a data-toggle="dropdown" class="nav-link dropdown-toggle active" href="#">Home</a>
<div class="dropdown-menu">
<ul>
<li>
<a class="dropdown-item menu-link dropdown-toggler" href="#">Header Styles</a>
<div class="dropdown-menu">
<ul>
<li>
<a class="dropdown-item nav-link nav_item" href="transparent-header.html">
Transparent
</a>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li><!---- end of features ------>
</ul>
这是我试图修改以实现结果的 WP 导航菜单功能:
<div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
<?php
wp_nav_menu(
array(
'menu' => '',
'container' => 'ul',
'container_class' => '',
'container_id' => '',
'menu_class' => 'navbar-nav',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '',
'item_spacing' => '',
'depth' => 0,
'walker' => '',
'theme_location' => 'custom_nav_menus',
)
);
?>
</div>
我从未尝试过自己制作 Wordpress 菜单,因此提前感谢社区的帮助。