• Resolved awalls

    (@awalls)


    Hi,

    I am having a strange problem with a theme I am developing in that as part of the theme I have defined two menu areas a main nav and a footer nav. I have defined these in my function.php file as follows:

    if (function_exists('register_nav_menus')) {
      register_nav_menus(
        array(
          'main_nav'    => "Main Nav Menu",
          'footer_nav'  => "Footer Menu"
        )
      );
    }

    Now within my theme I can see that it now supports two navigation areas:

    http://awesomescreenshot.com/0d5499k9b

    And within my header.php and footer.php I have defined the following:

    <div id="nav-bar">
      <ul class="cf">
        <?php wp_nav_menu(
          array(
            'menu'	=> 'main_nav',
          ));
        ?>
      </ul>
    </div>

    and

    <ul class="menu cf floatLeft">
      <?php wp_nav_menu(
        array(
          'menu'	=> 'footer_nav',
        ));
      ?>
    </ul>

    However both menus areas always show the main menu even if from within the menus area I have defined one to us main and the other to use footer. Even more confusiing if I leave both of these blank I’d expect to see no menu displayed in these areas but it always displays the main menu.

    Would appreciate some advice as to where I might be going wrong.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The parameters to wp_nav_menu are confusing. I think that ‘main_nav’ and ‘footer_nav’ are actually theme_location’s. Give this a try:

    <ul class="menu cf floatLeft">
      <?php wp_nav_menu(
        array(
          'theme_location'	=> 'footer_nav',
        ));
      ?>
    </ul>
    Thread Starter awalls

    (@awalls)

    Thanks, that worked. The parameters are a bit confusing. Am a WP newbie and just getting used to its “idiosyncrasies” 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issue with custom menus’ is closed to new replies.