Wordpress Menu - Toggle does not open when you press

Asked

Viewed 256 times

0

I am developing a project in Wordpress, and I have problems with my menu. When I test the site in smaller resolutions, the toggle box does not open it. Since I am rather embarrassed about the HTML issue with PHP, I think that something is missing to make that pressing toggle box the menu opens down normally.

<div class="row">
  <div class="col-xs-12">

    <div class="dbn-header-flex">


      <div class="dbn-header-menu">

        <?php 

          wp_nav_menu( array(
                  'theme_location'  => 'header-menu',
                  'depth'           => 3,
                  'container'       => 'div',
                  'container_class' => 'dbn-header-menu hidden-sm hidden-xs',
                  'container_id'    => '',
                  'menu_class'      => 'dbn-menu',
                  'fallback_cb'     => 'wp_bootstrap_navwalker::fallback',
                  'walker'          => new wp_bootstrap_navwalker(), // Apply bootstrap menu mode
                ) ); 
              ?>

      </div>



      <div class="dbn-header-search">

         <?php
          // Busca
          include('searchform.php'); ?>
      </div>

      <!-- Brand and toggle get grouped for better mobile display -->
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>

    </div> <!-- /.dbn-header-flex -->

  </div><!-- /.col-xs-12 -->
  </div><!-- /. row -->

  • Peter. Possibly the classes hidden-sm hidden-xs are hiding their menu in resolutions 768px to <991px and <768px, respectively. Remove them and test to see if it solves.

  • So, anyway, even taking these classes, the menu appears, but it doesn’t stay inside the toggle box. It would be right to click on it and open neh? According to the bootstrap, but not rolling. PHP with Wordpress and bootstrap, until I get used to it, I always curl up.

  • 1

    Your data-target should point to the id from the menu. For example: data-target="#idMenu , if your menu has <div id="idMenu" (...)>. And in this case to set your id you must reference it here: 'container_id' => 'idMenu'

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.