Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 95984

roganty on "Wrong menu being displayed by wp_nav_menu()"

$
0
0

Hi,
Firstly I hope this is posted in the right forum!

I'm creating my own theme and I've added menu support, but I'm having trouble with the wrong menu being displayed.

In functions.php I have

add_action( 'init', 'roganty2_menus' );

function roganty2_menus(){

	register_nav_menus(
		array(
			'main-menu' => 'Main Menu'
		)
	);

}

In header.php I have

<?php wp_nav_menu( array('theme-location' => 'main-menu', 'container' => false, 'depth' => 1) ); ?>

In the back end I have two menus, 'Long Menu' and 'Short Menu'
I have selected 'Short Menu' to be in the 'Main Menu' location, but it only displays 'Long Menu'.

The only way it displays 'Short Menu' is if I delete 'Long Menu'. As soon as I recreate 'Long Menu' it starts displaying 'Long Menu' again!

Other things I have tried:

  1. Deleting cache
  2. Renaming 'Short Menu' to 'Main Menu'

Has anyone got any ideas??


Viewing all articles
Browse latest Browse all 95984

Trending Articles