I'm a wordpress beginner and at the moment struggling to get to grips with custom menus. I have created two menus. Wordpress tells me the theme supports two menus. I have

<?php wp_nav_menu('menu=services_menu'); ?>

Where I want one menu to appear. I have

<?php wp_nav_menu('menu=left_navigation'); ?>

Where I want the other menu to appear.

I have

<?php
if ( function_exists( 'register_nav_menus' ) ) {
    register_nav_menus(
        array(
          'services_menu' => 'Services menu',
          'left_navigation' => 'Left vertical navigation Menu'
        )
    );
}
?>

In functions.php.

Both menus appear under "Appearance -> menus ->Theme locations" and are associated correctly. But only the services menu ever appears, in both locations. I've read a welter of different solutions to doing this, none of which seem to have any result other than the one described above. Where am I going wrong?

link|improve this question

67% accept rate
I seem to have now solved this myself. Perhaps there are many different ways of doing this and I happened to get two different ways mixed up. I'm not sure, but I have now found a different example in the codex and got it working. – Tony B Feb 23 '11 at 13:06
You should post the solution that you found, as an answer, so that others can benefit from what you found. WPSE is a shared information/resource site, not a typical support forum. – Chip Bennett Jan 18 at 17:30
feedback

2 Answers

up vote 0 down vote accepted

The problem is that wp_nav_menu() should really only ever be calling theme_location, not menu.

The Theme defines menu locations, and then places those menu locations in the template. The user defines menus, and assigns menus to theme locations.

So, change this:

<?php wp_nav_menu('menu=services_menu'); ?>

...to this:

<?php wp_nav_menu( 'theme_location=services_menu' ); ?>
link|improve this answer
feedback
<?php wp_nav_menu( array('menu' => 'menu name' )); ?>

possibly?

link|improve this answer
Er, yup :o) I noticed though that if you trash pages, they are still appearing in the menu (although you get a 404 if you click on the link) - is that a known bug or something wrong with what I have done? – Tony B Feb 23 '11 at 14:58
Hmm, mine doesn't do that (with auto-generated page list)... is this for an auto generated menu? Or a custom made one? Possibly with custom made menus, anything you add manually you have to delete manually? – Rev. Voodoo Feb 23 '11 at 15:37
yeah it's a custom one has "add new top level pages automatically" ticked. You'd think if it added them automatically it would also remove them automatically.. – Tony B Feb 23 '11 at 21:27
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.