Bootstrap wordpress mobile menu not working

2019-09-07 04:16发布

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.

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>

1条回答
太酷不给撩
2楼-- · 2019-09-07 05:14

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

查看更多
登录 后发表回答