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've just begun participating these stack overflow forums yesterday and had a great experience with someone who could problem solve with me. working from the admin panel under the themes tab i have what looks like a working theme locations panel. i followed instructions i found for installing the proper php code in the proper functions.php file and then placed it where i wanted it to appear in the proper file for my theme. my issue is it won't actually function the way it was intended, i have 3 different menu's created but the site displays every page i created. i obviously slipped somewhere along the way but i can't find where.

here's what i have in my functions.php:

        add_theme_support( 'menus' );

add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
    register_nav_menus(
        array(
            'primary-menu' => __( 'Primary Menu' ),
            'secondary-menu' => __( 'Secondary Menu' )
        )
    );
}           

here's whats in my sidebar.php:

<aside>
    <div class="textBody">
    <div class="sideNav">
        <?php wp_nav_menu( array( 'theme_location' => 'extra-menu' ) ); ?>
    </div>
    </div>
</aside>

still learning, even posting on this site has a learning curve... thanks for reading this and any help or time is appreciated.

share|improve this question
1  
Please use proper Upper-/lowercase letters. That makes a much better reading experience. Thanks. –  kaiser Sep 13 '12 at 12:55
    
@Ijan Hilaire Have you set menus in Appearance->menu in admin page? –  Ravichandran Jothi Sep 13 '12 at 12:58
add comment

1 Answer

Your menu name doesn't match in your sidebar. The theme_location should match the name of one of the registered menu's in your functions.php file.

Try replacing what you have with this:

For the functions.php file:

<?php
add_theme_support( 'menus' );
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
  register_nav_menus(
    array(
      'primary' => __( 'primary' ),
      'secondary' => __( 'secondary' )
      )
    );
  }
?>

For the sidebar.php file:

<aside>
  <div class="textBody">
    <div class="sideNav">
      <?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?>
    </div>
  </div>
</aside>
share|improve this answer
    
hi jared, thanks for catching that the name didn't match. i've been trying to switch through the code to see what works and didn't return the names to a matching state. that said, the code you passed me still didn't unlock this side navigation. –  Ijan Hilaire Sep 13 '12 at 6:13
    
Depending on your version of WordPress it might need to be placed inside of a after_theme_setup function/hook. See my answer to this question (the section labeled "the FIX" is what you should read). Let me know if that doesn't work or if you need more help. –  Jeremy Jared Sep 13 '12 at 7:30
    
hey jared, i'm sorry its taken days for me to respond but i had to abandon my original design and hope by modifying an existing theme i can satisfy my client. i'll back to revisit this issue as soon as i get this current project delivered or find time to finish resolving this issue. –  Ijan Hilaire Sep 18 '12 at 6:30
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.