• I integrated bootstrap off-canvas menu to my wordpress and to my dismay, the menu item is hidden on the desktop mode.

    what is wrong with my code?

    <header id="masthead" class="site-header sticky-top" role="banner">
    	<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-xl">
          <a class="navbar-brand" href="#">Logo</a>
          <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#primaryNav" aria-controls="primaryNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
    
    	  <div class="offcanvas offcanvas-start" tabindex="-1" id="primaryNav" aria-labelledby="primaryNavLabel">
    		 <div class="offcanvas-header">
    			<a class="navbar-brand offcanvas-title" id="primaryNavLabel" href="#">Logo</a>
    			<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    		</div><!--offcanvas-header-->
    		  
    
    							<?php
    			wp_nav_menu( array(
    				'theme_location'    => 'primary',
    				'depth'             => 2,
    				'container'         => 'div',
    				'container_class'   => 'offcanvas-body',
    				'container_id'      => false,
    				'menu_class'        => 'navbar-nav ms-auto mb-2 mb-lg-0 py-lg-3',
    				'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
    				'walker'            => new WP_Bootstrap_Navwalker(),
    			) );
    			?>
    			 
            <?php get_search_form(); ?>   
          </div>
        </div>
      </nav>
    • This topic was modified 2 years, 10 months ago by t-p. Reason: Moved to Fixing WordPress from Developing with WordPress
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Isn’t that what Offcanvas is supposed to do? Hide a container like a sidebar or nav menu? More detail on what you want to accomplish would be helpful, as would a link to a live page demonstrating the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘get problem with wp_nav_menu’ is closed to new replies.