所以您添加了primary
菜单位置
然后,您可以在以下几行中添加菜单(最好在header.php
):
<nav id="menu-bar" class="navbar navbar-fixed-top navbar-light w-100">
<a id="" class="navbar-brand" href="#">
</a>
<button style="display:block;" id="responsive_hamburger" class="hamburger navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-content" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="hamburger-box ">
<span class="hamburger-inner "></span>
</span>
</button>
<div class="collapse navbar-collapse float-right" id="navbar-content">
<?php $defaults=array(
\'theme_location\' => \'primary\',
\'container_id\' => \'navbar-content\',
\'container\' => \'\',
\'container_id\' => \'\',
\'container_class\' => \'\',
\'menu_id\' => false,
\'menu_class\' => \'navbar-nav ml-auto\',
\'depth\' => 0,
\'fallback_cb\' => \'class-wp-bootstrap-navwalker::fallback\',
\'walker\' => new wp_bootstrap_navwalker(),
\'add_li_class\' => "nav-item mx-4"
);
wp_nav_menu($defaults);?>
</div>
</nav>
The
theme_location
array属性正在将此菜单添加到主菜单位置。