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.

17 responses to “Add another WordPress Menu”

  1. Natanel Avatar
    Natanel

    thanks! it really helps.

  2. Balaji Gahire Avatar
    Balaji Gahire

    thanks! for helps.

  3. whatsthebigidea.com Avatar

    Thank you Thad! Now if I can find a way to add a pipe symbol between each link….

  4. Cicak Avatar
    Cicak

    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

  5. pakito Avatar
    pakito

    Hi,

    You say “You can either add this to your theme files”. Which files? All of them?

    Thanks

  6. Dave Murray Avatar
    Dave Murray

    Thats brilliant – thank you!

  7. Jess Webb Avatar

    Thank you sooooooo much for this! It was JUST what I needed, you’ve saved my life! 😉

  8. Wendell Christian Avatar
    Wendell Christian

    Muito obrigado pela ajuda!
    Thank!

  9. Johannes Fumow Avatar
    Johannes Fumow

    That was helpful, thank you!

  10. shubham prajapati Avatar

    thank you for this, hope it will work on wpzoom theme as well..
    http://www.alltechmantra.com

  11. dalboslampen Avatar
    dalboslampen

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

  12. gabrielcintra80 Avatar
    gabrielcintra80

    Thanks man!

  13. kenkhero Avatar
    kenkhero

    thank you this was very helpful.

  14. Allen Andersen Avatar

    Got a 500 server error after adding this. it went away after deleting it. any idea why?

  15. MS Avatar
    MS

    this was very helpful, thank you! How do I make the list horizontal instead of vertical? Thanks for your help!

  16. The Kargah Avatar
    The Kargah

    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?

  17. Jenny Dearborn Avatar

    Thank you sooooooo much for this! It was JUST what I needed……..

Leave a Reply

Your email address will not be published. Required fields are marked *