Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 '12 at 17:30
add comment

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' ); ?>
share|improve this answer
add comment
<?php wp_nav_menu( array('menu' => 'menu name' )); ?>

possibly?

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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