Add another WordPress Menu

Open up your theme folder and locate the functions.php file.  Search for a function called register_nav_menu (used in TwentyEleven theme) or register_gpp_menus (used in most GPP themes).  It looks like this in many of our themes:

function register_gpp_menus() {
             register_nav_menus(
                 array(
                     'main-menu' => __( 'Main Menu' )
                 )
             );
         }

We are going to add another item to the array, called Second Menu, like this:

        function register_gpp_menus() {
            register_nav_menus(
                array(
                    'main-menu' => __( 'Main Menu' ),
                    'second-menu' => __( 'Second Menu' )
                )
            );
        }

Now that we have registered a new nav menu item, you should see the Second Menu on your Theme – Menus page in your WordPress admin panel. Add menu items to it and save the menu.  Now we need to display the menu somewhere in your theme. You can either add this to your theme files:

<?php wp_nav_menu( 'sort_column=menu_order&menu_class=sf-menu&theme_location=second-menu' ); ?>

Or, you can add the menu to a Widget using your Theme – Widgets panel in your WordPress admin panel.  If you want to style your menu differently, you can add a different menu class to the wp_nav_menu() function above:  menu_class=second-menu And then add some css to your custom CSS panel to help style that menu. This is not mandatory, though.

Newsletter
Join over 280,000 independent website owners

The next person to join our monthly newsletter gets a 25% off coupon!

We guarantee 100% privacy. Your information will not be shared.

This entry was posted in . Bookmark the permalink.

Posted by , at Graph Paper Press

Thad is the founder of Theme.Works and Graph Paper Press. Previously, he produced online multimedia and documentary projects for USA Today including the inauguration of President Barack Obama and many others. He lives in Brooklyn, NY with his wife Abby.

  • Google
  • Blog
  • Instagram

17 thoughts on “Add another WordPress Menu”

  1. Hi. I got the menu to appear in my theme but it seems as though the actual menu that appears reflects all the pages found in my ‘Pages’ menu rather than what is supposed to appear according to the ‘Menu’ pannel. How can I get the newly created menu to only display the pages specified in the ‘Menu’ pannel rather than a list of every page I have? You can see what I mean here Click Here

  2. Hi
    Great guide! Could you help me make the menu horizontal? I am familiar with css, but a kickstart would be greatly appreciated!

  3. I have added the first code in functions.php and in menu location its showing the secondary menu.
    The question is where should i put the second code if i want to show nav menu in sidebar?

Leave a Reply