<div class="navbar-collapse collapse">
<?php
$args = array(
'menu' => 'header-menu',
'menu_class' => 'nav navbar-nav',
'container' => 'false'
);
wp_nav_menu( $args );
?>
</div>
wp_nav_menu( array(
'menu' => 'primary',
'theme_location' => 'primary',
'depth' => 3,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<?php
$args = array(
'menu' => 'header-menu',
'menu_class' => 'nav navbar-nav',
'container' => 'false',
'fallback_cb'=> 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker()
);
wp_nav_menu($args);
?>
</div>
</div>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
Вот Function:
<code lang="php">
function register_theme_menus() {
register_nav_menus(
array(
'header-menu'=> __( 'Header Menu')
)
);
require_once('wp_bootstrap_navwalker.php');
}
add_action( 'init', 'register_theme_menus');
</code>