为什么深度2隐藏我的父菜单而不显示任何子菜单,一旦我再次将其更改为1,它就显示父菜单但子菜单却没有显示。我也尝试更改我的js版本和引导程序,但仍然无法正常工作。我还检查了浏览器的控制台,但未发现错误。我正在使用bootstrap 3.3.7
<nav class="nav navbar navbar-default navbar-right navbar-fixed-top" id="onscroll" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php echo home_url(); ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/img/logo.png" class="img-responsive" alt="xxxx"></a>
</div>
<?php
// Menu Location
wp_nav_menu( array(
'menu' => 'Primary',
'theme_location' => 'primary',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav navbar-right',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker())
);
?>
</div>
</nav>
here's my functions.php
// Register Custom Navigation Walker
require('class-wp-bootstrap-navwalker.php');
register_nav_menus( array(
'primary' => __( 'Primary', 'xxxxx-xxxxx' ),
) );
add_action( 'init', 'register_nav_menus' );