WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» Video: Adding a Second Menu to the WordPress Twenty Ten Theme

Video: Adding a Second Menu to the WordPress Twenty Ten Theme

Last updated on June 22nd, 2012 by Editorial Staff
22 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
Video: Adding a Second Menu to the WordPress Twenty Ten Theme

The Twenty Ten theme only comes with one default menu, which is included in the header. However the theme also supports multiple menus, thanks to the use of  register_nav_menus(). Here’s a quick tip on how to take advantage of this function and add a second menu to the Twenty Ten theme.

Watch the Screencast

Functions.php

Open the functions.php file and look for:

// This theme uses wp_nav_menu() in one location.

The next line is where we see the register_nav_menus() being used. As you can see this function accepts an array.

register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
) );

primary: this is a key, or name of the menu, this name should be unique within the array

__( ‘Primary Navigation’): this is the vaule of the key, or description of the menu

To add the second menu simply add another key (menu name) and assign a value (enter description) into the array. Here’s an example of what it can look like when adding your second menu:

register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
'secondary' => __( 'Secondary Navigation', 'twentyten' ),
) );

This technique can be used in creating other free themes or child themes as well. If you have any questions, feel free to ask in the comment.

22 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

21 Comments

Leave a Reply
  1. Editorial Staff says:
    Mar 12, 2012 at 8:03 am

    Yes, you can use WordPress conditional statements and target each individual page, all single posts page, all archive pages etc.

    Reply
  2. rtrivett says:
    Nov 22, 2011 at 11:41 am

    I created and added the second menu (mirror’s the top one at the bottom) in the ‘twenty-ten-theme’ but it doesn’t display. Not sure how to make it visible???

    Reply
  3. wiredcanvas says:
    Aug 23, 2011 at 4:48 am

    Very useful, thanks!

    Reply
  4. omermiron says:
    Jul 5, 2011 at 11:42 am

    Hi.

    Can i use this as a second horizontal line (below primary navigation).

    I want to make it a submenu for one element of the primary menu.

    possible??

    Reply
  5. Mark Baynes says:
    Feb 7, 2011 at 4:01 am

    Hi

    Thanks very much for this – short, sharp and to the point.

    mark

    Reply
  6. Russ says:
    Jan 31, 2011 at 9:18 pm

    Help!

    I was trying to add a second menu…i have lost access to my sight adminstration. I now get the following page when I try to access my site or my site administration:

    Parse error: syntax error, unexpected ‘=’, expecting ‘)’ in /home4/findyow1/public_html/wp-content/themes/twentyten/functions.php on line 98

    how do i get back to the function.php to correct this error?

    also… it is obvious that i am not up to this task… are there themes where i will not have to go into the code?

    Reply
    • Editorial Staff says:
      Feb 1, 2011 at 10:55 am

      Remember you have curly quotes… make sure you fix those.

      Reply
    • Khaled Hakim says:
      Feb 1, 2011 at 11:42 am

      Russ, you need to access your website hosting using FTP and then finding the functions.php file, downloading it and editing it with a text editor.

      If you need more help or directions email me: Khaled@kman.me

      Cheers.

      Reply
      • Russ says:
        Feb 2, 2011 at 10:09 am

        Thank you Khaled. I have your email, and I am sure I will use it. I really want a very simple website, but I am struggling. I will do some more reading, and contact you if things do not become more clear. …Russ

        Reply
  7. Russ says:
    Jan 31, 2011 at 8:30 pm

    I am a complete newbie. If I am understanding correctly, I must repeat the above directions for each menu I wish to add? so if I wanted to add a menu named “Articles” it would look like:

    register_nav_menus( array(
    ‘primary’ => __( ‘Primary Navigation’, ‘twentyten’ ),
    ‘Articles’ => __( ‘Articles Navigation’, ‘twentyten’ ),
    ) );

    Reply
    • Editorial Staff says:
      Feb 1, 2011 at 10:54 am

      yes that is correct.

      Reply
  8. jane says:
    Nov 16, 2010 at 5:52 pm

    I’d like a secondary horizontal menu to replace the main menu on certain pages for logged-in members only. Is this possible? Thanks

    Reply
    • Editorial Staff says:
      Nov 17, 2010 at 10:35 am

      Yes, that is possible. You are going to have to utilize the is_user_logged_in hook from the WordPress codex.

      Reply
  9. Himanshu vyas says:
    Oct 11, 2010 at 3:42 am

    When I use this method to create secondry menus, my menus are duplicating each other. I also want to know how to create pages for secondry menus, I am confused little bit. Can you help me?

    Reply
    • Khaled Hakim says:
      Oct 11, 2010 at 2:18 pm

      After following the above steps (editing the functions.php file found in your TwentyTen theme directory (http://yoursite/wp-content/themes/twentyten/functions.php ) you will need to log into your wordpress admin panel and click on Appearance (on the right hand side) and then click on MENUS. You will be able to add a new menu there. Make sure that you give this newly created menu the same name you gave it when you edited the functions.php file.

      As for pages under this menu… Simply create pages by clicking on Pages in the right hand menu of the admin control panel. Once you’ve added the pages you want, you can go back to Appearance > Menus > and select which pages you wish to add to your menus. You will be able to add pages easily.

      I hope I was helpful.

      Reply
  10. Celia says:
    Aug 28, 2010 at 7:09 am

    I think i figured out why the menu bar was completely disappearing. But I’d still like to add the second menu into the child’s function.php instead of changing it through the dashboard’s editor.

    Reply
  11. Celia says:
    Aug 28, 2010 at 6:08 am

    I created a child theme…a lot of trial and error since I’m new to that too. But could not get the menu right. Something went screwy with the primary navigation and I’m trying to figure out why. I’d created another menu in the menu manager but when I try to use it as the primary navigation, the entire menu bar disappears. I was wondering if it’s because I’d changed the header size.

    In searching around for an answer, your tutorial seemed the more plausible fix.

    Reply
  12. Celia says:
    Aug 27, 2010 at 6:54 pm

    Great tutorial, thanks. I was wondering how to use this for a child theme. I’m a novice to the functions.php and am not sure how to go about using the unhook filter instructions given by the wordpress codex.

    Reply
    • Editorial Staff says:
      Aug 27, 2010 at 11:55 pm

      Are you trying to create a child theme of your own? or are you trying to modify an existing one?

      Reply
  13. Khaled Hakim says:
    Jul 31, 2010 at 5:18 pm

    Thank you for concise and to the point explanation. Appreciate the time you put into helping others by posting such helpful information.

    I’m bummed that twentyten came with only one menu though. They should’ve atleast created two!

    Thanks Though… looks easy enough.

    Reply
  14. Ben Joven says:
    Jul 27, 2010 at 12:27 pm

    Nice…I like how you move the cursor super slow!!!

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
PushEngage
PushEngage
Increase your website traffic & revenue with push notifications. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
ON1 Photo
ON1 Software Coupon
Get 20% off ON1 Photo Raw, ON1 Resize, and other ON1 Software.
Media Temple
Media Temple Coupon
Get 20% OFF on all Media Temple hosting plans.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.