Wordpress Bootstrap Navwalker 让我疯狂
Wordpress Bootstrap Navwalker Driving Me Bonkers
在移动设备上扩展 navwalker 时遇到问题。
我已经将代码添加到函数中 php
// Register Custom Bootstrap Navigation Walker
require_once get_template_directory() . '/wp-bootstrap-navwalker.php';
这是我的navwalker代码,如果有人能帮我解决这个难题,我将不胜感激。请原谅这里的格式。
<nav class="main-menu navbar navbar-bg thetop" role="navigation">
<div class="container-fluid">
<!-- 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-example-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>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="<?php echo home_url(); ?>">
<?php if (function_exists('the_custom_logo')) {
the_custom_logo();
}
else{
bloginfo('name');
}
?>
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<ul class="nav navbar-nav">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'depth' => 2,
'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())
);
?>
</ul>
<!-- Search Form -->
<form id="searchform" class="navbar-form navbar-right" role="form" action="<?php echo home_url( '/' ); ?>">
<div class="input-group">
<input type="text" class="form-control" name="s" placeholder="Ara"><span class="input-group-btn"><button type="submit" class="btn btn-default btn-primary -red"><span class="glyphicon glyphicon-search"></span></button></span>
</div>
<a href="#" class="btn btn-top-cta affirmation hidden-xs hidden-sm"></a>
</form>
</div>
</nav>
没关系,我想通了。我正在使用 wpBootstrapStarter 构建一个新主题。最近更新了主题,还使用 jquery 3.3.2 更新了 bootstrap 版本。我刚刚降级,一切都很好。
我猜开发者在发布前没有完全测试。我通过控制台发现的干得好。
在移动设备上扩展 navwalker 时遇到问题。
我已经将代码添加到函数中 php
// Register Custom Bootstrap Navigation Walker
require_once get_template_directory() . '/wp-bootstrap-navwalker.php';
这是我的navwalker代码,如果有人能帮我解决这个难题,我将不胜感激。请原谅这里的格式。
<nav class="main-menu navbar navbar-bg thetop" role="navigation">
<div class="container-fluid">
<!-- 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-example-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>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="<?php echo home_url(); ?>">
<?php if (function_exists('the_custom_logo')) {
the_custom_logo();
}
else{
bloginfo('name');
}
?>
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<ul class="nav navbar-nav">
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'depth' => 2,
'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())
);
?>
</ul>
<!-- Search Form -->
<form id="searchform" class="navbar-form navbar-right" role="form" action="<?php echo home_url( '/' ); ?>">
<div class="input-group">
<input type="text" class="form-control" name="s" placeholder="Ara"><span class="input-group-btn"><button type="submit" class="btn btn-default btn-primary -red"><span class="glyphicon glyphicon-search"></span></button></span>
</div>
<a href="#" class="btn btn-top-cta affirmation hidden-xs hidden-sm"></a>
</form>
</div>
</nav>
没关系,我想通了。我正在使用 wpBootstrapStarter 构建一个新主题。最近更新了主题,还使用 jquery 3.3.2 更新了 bootstrap 版本。我刚刚降级,一切都很好。
我猜开发者在发布前没有完全测试。我通过控制台发现的干得好。