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 Creating Bootstrap Navigation in WordPress

Konrad Pilch
Konrad Pilch
2,435 Points

Where is 'header-menu' ?

HI,

I do get the code but i jsut dont get one thing, what is

'menu' => 'header-menu' ? i dont see this anywhere

I know that menu class is the bootstrap nav navbar-nav so it displays the styles etc..

container is set so it wont display , but header-menu?

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

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

        <div id="navbar" 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>
    </nav>

3 Answers

Karim Ramadan
Karim Ramadan
13,849 Points

When you first register a menu you have to give it a name or location that will apperas on the back end under apperance > menus > theme settings. That way if you have more than one menu, for example a header menu and a footer menu you can easily assaign menus to that locations.

Konrad Pilch
Konrad Pilch
2,435 Points

so i can jsut make up and put something else instead of 'header-menu' right? its like the name in the dashboar? kinda?

Karim Ramadan
Karim Ramadan
13,849 Points

Yes, but you need to change that id also on the functions.php

Konrad Pilch
Konrad Pilch
2,435 Points

So header-menu is the standard? and im assuming there will be footer-menu , and if i want .eg sidebar-menu, i would have to create a new functinon right?

Well, like this? https://codex.wordpress.org/Navigation_Menus

Karim Ramadan
Karim Ramadan
13,849 Points

No, not standard. this is just an example. You can name it as you wish