Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development The WordPress Loop The WordPress Loop Quiz

Bootstrap nav walker

Below are the codes for my function : <?php if (!isset($content_width)){ //control max-width of the page $content_width = 660;

}

require_once ('wp_bootstrap_navwalker.php');

register_nav_menus( array( 'primary' => __( 'Primary Menu', 'tranquilwp' ) ) );

function tranquil_scripts() {

/*.  Add styles to the scripts         */


wp_enqueue_style('bootstrap-core', get_template_directory_uri().'/css/bootstrap.min.css');
wp_enqueue_style('custom', get_template_directory_uri().'/style.css');


/*.  Add Javascripts          */

wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() .'/js/bootstrap.min.js', array('jquery'), '', true );

wp_enqueue_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js', true, '1.12.4');

}

add_action('wp_enqueue_scripts', 'tranquil_scripts');

And below are my codes for bootstrap menu . Dropdown menus works but the toggle icon do not when , when I set it up to mobile screen . I need to understand why its not working .

<nav class="navbar navbar-default " role="navigation">

<div class="container-fluid"> <div class="navbar-header ">

<!-- Brand and toggle get grouped for better mobile display -->

 <button type="button" class="navbar-toggle " data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
    <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
  </button>

<a class="navbar-brand" href="<?php echo home_url(); ?>"> <?php bloginfo('name'); ?> </a> </div>

<div id="navbar" class="navbar-collapse collapse navbar-right  ">

    <?php
    wp_nav_menu( array(
        'theme_location'    => 'primary',
        'depth'             => 2,
        'container'         => 'false',
        'container_class'   => ' collapse navbar-collapse',
        'container_id'      => 'navbar',
        'menu_class'        => 'nav navbar-nav ',
        'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
        'walker'            => new WP_Bootstrap_Navwalker())
    );
    ?>

</div>

</div> </nav>