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 From Bootstrap to WordPress Setup a Bootstrap Theme Adding Ability for Dropdown Navigation

Rachel Khoong
Rachel Khoong
7,970 Points

When in mobile, the nav toggles down but doesn't toggle back up?

Pretty stumped. Tried substituting code from my own mockup and the final project files and it still won't close... help :(

Henrik Hansen
Henrik Hansen
23,176 Points

If you could submit some code that would be helpful. ;)

Rachel Khoong
Rachel Khoong
7,970 Points

Sorry! Pretty noob with the question-asking here. This is the HTML markup, which is the only thing I changed while doing this.

So it doesn't close when I click the 3-bars again. But it does load the next page closed when I select a menu item...

Sorry if I make little sense :(

<header>
            <nav class="navbar navbar-inverse navbar-fixed-top">
                <div class="container">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header theNav">
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                            <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 bloginfo( 'url' ); ?>">
                            <img src="<?php bloginfo('template_directory')?>/img/levelupdicelogo_text.png" alt="Brand" class="hidden-xs"/>
                            <img src="<?php bloginfo('template_directory')?>/img/levelupdicelogo.png" alt="Brand" class="visible-xs"/>
                        </a>
                    </div>
                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse theNav">
                        <?php 
                            $args = array(
                            'menu'          =>  'header-menu',
                            'menu_class'    =>  'nav navbar-nav navbar-right',
                            'container'     =>  'false'
                            );
                            wp_nav_menu($args);
                        ?>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>
        </header>

2 Answers

Juliette Tworsey
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 Points

Hi Rachel,

Try this in your header.php file like so:

  <body <?php body_class(); ?>>

    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <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 bloginfo( 'url' ); ?>"><?php bloginfo( 'name' ); ?></a>
        </div>

        <div class="navbar-collapse collapse">

          <?php 
            $args = array(
              'menu'        => 'header-menu',
              'menu_class'  => 'nav navbar-nav',
              'container'   => 'false'
            );
            wp_nav_menu( $args );
          ?>

        </div><!--/.navbar-collapse -->

      </div>
    </div>

Then include your header.php file in your index.php, home.php, front-page.php, and archive.php files (..not sure if you have already done this or not):

Let me know if you're still stuck:-)

Henrik Hansen
Henrik Hansen
23,176 Points

Also check what css and js is included. Perhaps you did some css override?

Joe Schultz
Joe Schultz
6,191 Points

That helped me out. Thanks!

Rachel Khoong
Rachel Khoong
7,970 Points

Thanks everyone for your help! I ended up just redoing it and now it works.. Thanks though!