Bootstrap wordpress移动菜单不工作 [英] Bootstrap wordpress mobile menu not working

查看:145
本文介绍了Bootstrap wordpress移动菜单不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用bootstrap与wordpress制作我自己的自定义主题。
手机菜单用来工作正常。但是当我试图放在另一个菜单,它停止工作。我不知道我做错了什么。

I am using bootstrap with wordpress to make my own custom theme. The mobile menu used to work fine. but when I tried to put in another menu it stopped working . I don't know what I did wrong.

我使用wp_bootstrap_navwalker作为菜单。

I am using the wp_bootstrap_navwalker for the menu.

就像很多代码,它可能会出错,我不能发布代码,因为有很多文件包括。

There is like alot of code where it could go wrong, I can't post the code because there is like alot of files included.

<nav class="navbar site-navigation main-navigation" 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-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>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
              <?php
                    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',
                        'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
                        'walker'            => new wp_bootstrap_navwalker())
                    );
                ?>
        </div>
    </nav>


推荐答案

我发现有什么问题,复制一个带有ID的div。感谢您的帮助Alex Davin!

I found out what was wrong, it was indeed a duplicate of a div with an id. Thanks for your help Alex Davin!

这篇关于Bootstrap wordpress移动菜单不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆