Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Bryan Phelan
Bryan Phelan
18,191 Points

Additional Custom Menu not working in WordPress

I am working on the WordPress creating custom menu video and I'm having trouble adding a 2nd custom menu. The video says to add additional menus simply add them to the array within the register_nav_menus function. Below is what I have in my functions.php file

// Create a custom menus
function register_my_menus() {
  register_nav_menus(
    array(
        // Create new menus below w/ in array
      'footer-menu' => __( 'Footer Menu' ),
      'side-menu' => __( 'Side Menu' )  
    )
  );
}
add_action( 'init', 'register_my_menus' );

The sidebar menu is taking the values from my footer menu even though I have different menus with different links created in my admin portal. Here is the code in my footer.php file

<footer id="colophon" class="site-footer" role="contentinfo">
            <?php get_sidebar( 'main' ); ?>
            <div class="site-info">
                <?php wp_nav_menu( array('menu' => 'Footer Menu' )); ?>
                <?php do_action( 'twentythirteen_credits' ); ?>
                <p>&copy;2016</p>
                <?php if ( ! dynamic_sidebar( 'downlow' ) ); ?>
            </div><!-- .site-info -->
        </footer><!-- #colophon -->
    </div><!-- #page -->

    <?php wp_footer(); ?>

And my sidebar.php file...

if ( is_active_sidebar( 'sidebar-2' ) ) : ?>
    <div id="tertiary" class="sidebar-container" role="complementary">
        <div class="sidebar-inner">
            <div class="widget-area">
                <?php dynamic_sidebar( 'sidebar-2' ); ?>
                <?php wp_nav_menu( array('menu' => 'Side Menu' )); ?>
            </div><!-- .widget-area -->
        </div><!-- .sidebar-inner -->
    </div><!-- #tertiary -->
<?php endif; ?>
Bryan Phelan
Bryan Phelan
18,191 Points

Ok.... not sure what was happening but it seems to be working now.