我在WordPress中设计了一个新主题。我使用引导菜单栏进行响应性设计,但在桌面模式下显示一个切换。
<div id="nav">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<?php
wp_nav_menu( array(
\'menu\' => \'top-menu\',
\'depth\' => 2,
\'container\' => \'div\',
\'container_class\' => \'navbar-collapse collapse\',
\'menu_class\' => \'nav navbar-nav\',
\'fallback_cb\' => \'wp_bootstrap_navwalker::fallback\',
\'walker\' => new wp_bootstrap_navwalker())
);
?>
</div><!-- /.container-fluid -->
</nav>
add_theme_support(\'menu\');
require_once(\'wp-bootstrap-navwalker.php\');
register_nav_menus(
array(
\'top-menu\' => \'Top Menu Location\',
\'mobile-menu\' => \'Mobile Menu Location\',
));