WordPress.org

Ready to get started?Download WordPress

Forums

wp_nav_menu only shows first menu (2 posts)

  1. planky
    Member
    Posted 2 years ago #

    Im having a problem with wp_nav_menu seemingly ignoring the menu parameter - regardless of what I set as the value, it always shows the first menu I have (out of the two). Theme Locations in the admin gui shows two supported menus, both populated ('Header' and 'Sibebar')

    Have the following in my header:

    <? wp_nav_menu( array('menu' => 'First Menu' )); ?>

    and in my sidebar:

    <? wp_nav_menu( array('menu' => 'Second Menu' )); ?>

    Have the following code in my functions.php to register two menus with my theme:

    if ( function_exists( 'register_nav_menus' ) ) {
      	register_nav_menus(
      		array(
      		  'header_menu' => 'First Menu',
      		  'sidebar_menu' => 'Second Menu'
      		)
      	);
    }

    The code you see above was taken from another post here that the user said worked fine, so Im at a bit of a loss as to what Im doing wrong.

  2. planky
    Member
    Posted 2 years ago #

    And naturally, as soon as I post a topic, I discover the issue. The menus I created in the gui have to have the same name as what I defined in functions.

Topic Closed

This topic has been closed to new replies.

About this Topic