How to Add More Navigation Menus to your WordPress Theme

How to Add More Navigation Menus to your WordPress Theme

Sometimes you may find an awesome theme only to realize it would be great if it had an extra navigation menu with important or frequently used links to increase the usability of your WordPress site.

With just a little bit of coding you could have the foundation of your new menu set up quickly, and ready for you to style to match your theme.

If you would rather not mess around with code, there are many plugins that can do the heavy lifting for you, and also provide styling options. This goes double for our Upfront theme framework.

No matter which option you choose, the guide below will help you make it happen.

Basic Housekeeping

To create a new menu you need to edit your theme files. Before making changes to any of your core files, it’s best to backup your entire site in case something goes wrong along the way. You’ll be able to restore your site quickly and it will be as though nothing ever happened.

You can manually backup your site via FTP or using a plugin, such as our very own Snapshot or something like BackWPup. Just be sure you save a copy of both your database and files in a location separate to your site to minimize the risk of losing your backup.

Constructing a Child Theme

To create new menus with code, you need to make changes that would be lost when you update your theme. Creating a child theme takes care of this issue.

You can find the details you need to create a child theme by checking out a couple of our other posts How to Create a WordPress Child Theme and How to Automagically Create Child Themes in WordPress.

You can also choose to create a whole new theme of your own or try it out on a local or test site.

You can check out these posts for more details on how to create a local install of WordPress:

Once you have set up one of these options, you’re free to start creating your extra navigation menus. Though, if you decide to use a plugin or Upfront, you don’t need to create a child theme.

Creating New Menus

To add a selectable menu location option in your admin dashboard under Appearance > Menus you need to do what’s called “register a menu.” All it takes is adding a snippet of code to your functions.php file located in wp-content > themes > your-theme.

In cPanel, click on the File Manager icon in the Files section on the homepage. If you haven’t previously set your File Manager to load to your site’s document root, navigate there now.

There’s a functions.php file in your /wp-includes/ folder, but that’s not the one you need to edit. Make sure you find the functions.php file that’s found in the theme you’re using. Otherwise, you would end up with errors when trying to add the code found later on.

Locate your functions.php file and click on it once followed by clicking the Edit button at the top of the page.

The File Manager in cPanel. The functions.php file has been selected.
You can edit your theme’s functions.php file directly in cPanel.

If a pop-up opens, simply click the Edit button at the bottom, right-hand side. You may not see one if you have previously disabled it.

Scroll to the bottom of the file. If you’d like to add only one menu, add the following code on a new line:

In this example, New Menu is the name that will appear in your admin dashboard’s menu page to make it understandable for human eyes. The new-menu name is what WordPress will understand to execute your code properly.

You can call your menu whatever you like, but make sure only the human-readable name contains spaces and capital letters.

If you would like to add multiple menus to your site, add this code on a new line instead:

You can add as many new menus as you’d like with this method. The same rules will apply when naming them.

Save the changes you made to the file. Now all that’s left is adding the new menu to your site.

Adding Menu Locations to Your Theme

This is where you need to decide where you’d like to place your menu. If you’d like your menu to appear at the top of your page, you’ll need to edit the header.php file. You can also put it in your footer which means you would edit the footer.php file.

You can even display a menu on a page by editing its template file or to a sidebar, editing its sidebar.php file.

You can place your new menu where ever you’d like. Here’s the minimum amount of code you need to add to any of these locations:

Just replace new-menu with WordPress-readable name you chose. You probably want to style your menu with CSS so it goes beyond basic functionality and also looks great. To do this, you’ll need to create a class and add it to your theme with the following code.

Just like before, replace new-menu with the name you chose. In this example, I named the class I created new_menu_class. You can change this, but just be sure to update this code to reflect the adjustment.

Hit the Save button and head over to Appearance > Menus in your dashboard. You’ll notice your new menus will be listed under Theme Locations in the Menu Settings section.

The Menu Settings section.
The new registered menu items listed in the Menu Settings.

You’ll now be able to see your new menu locations listed. When you add a menu, you can select one or all of the locations.

To have links displayed in your newly made menu locations, click create a new menu at the top of the page.

The Menu page in the admin dashboard.
You can click the create a new menu link or enter a new name for your menu.

If you don’t already have a menu, you can enter a name for your menu in the field on the page, then click Create Menu. If you already have a menu previously created, you can click the create a new menu link toward the top of the page.

Once you have created a new menu, you can also manage the locations where they are displayed under the “Manage Locations” tab.

Styling, Plugins and Responsive Menus

Your new menu is now ready to be styled using CSS. The coding required is specific to the theme you’re using so I won’t go into it in this post, but we do have another post you can check out for that called How to Create an Awesome Responsive Menu for Your WordPress Theme. It also shows you how to create responsive menus that are mobile-ready.

If you would like an easier option, there are many plugins that will create responsive menus based on your theme’s styles. The best ones I found were Responsive Menu and Suppamenu Lite.

Some notable mentions you may also find helpful are ShiftNav, WP Responsive Menu and Max Mega Menu.

Adding Menus in Upfront

There’s also another way you can intuitively create and style menus and that’s with Upfront.

Upfront is our infinitely customizable, drag and drop theme framework. You can choose from a number of premade themes, then customize them as you see fit, even if it’s 100% different than the original.

It’s different from other theme frameworks because you can make a professional, robust theme, all by dragging and dropping elements directly onto the page and you can also see what it looks like right away.

You can add many advanced elements such as forms, image galleries, sliders, video backgrounds and parallax, and you can optionally customize it further with some CSS and Javascript if you want.

Creating a responsive site is also easy to do and if you’re a developer, you can set permissions so your clients can’t accidentally break their sites. We’re also constantly developing and adding new features to make the experience even more intuitive.

Upfront is also included in a WPMU DEV membership along with everything else we have to offer, including technical support and all our plugins. You can also try it all out for free with our 14-day trial if you don’t have a membership.

With our plugins, you could optimize your sites’ speed, harden your site or network’s security, compress and optimize your uploaded images automatically, backup your entire network or site and so much more. You can check them all out on our Plugins page.

Getting Started

Once you have Upfront and a theme installed and activated, you can start adding your menus. For more details on installing and activating Upfront, you can check out the Usage tab of one of the Upfront starter themes.

Adding a New Menu

Start by clicking the Upfront button in your admin bar to load up the Upfront editor.

The Upfront button in the admin bar.
Click the Upfront button to start up the editor.

Once the editor loads, you can either customize the menu that’s already in your starter theme or you can create a new one.

For details on how to change the existing menu and for the basics of editing with Upfront, you can check out our seven part post series starting with The Basics, Theme Colors and Typography.

To create your own menu, hover over a background region and click the pencil button that appears in the corner on the right hand side.

The region button at the top of the page in the Upfront editor.
You can edit any region on the page.

You can choose this button for any region where you want your menu either above or below it as well as to the left or right. Next, select one of the addition symbols to place your new region.

The plus sign at the top, bottom, left and right places the new region before the current one on the side where you clicked the button.

The edit region main settings.
You can place a new region to the left and right as well as on the top or bottom.

The Parrot theme in these examples already has a menu on the left so there isn’t an addition symbol displayed on that side.

Once one of the buttons have been clicked, you should see a pop-up appear to name your new region and soon-to-be menu. The field on the left can be used to create a new region whereas the dropdown field on the right can be used to select a pre-existing menu.

The region pop-up.
You can create a new region or select an existing one.

Select the radio button on the left or enter a name for your new region on the left to select that option.

If you want this region and your new menu to be displayed on all pages of your site, select the Make this a Global Region checkbox. Otherwise, the new region would only appear on the page you’re currently editing.

Once you’re done, click the OK button to create your new region.

Your new region should be displayed and you can click and drag the rectangular button centered at the bottom of the region to resize it and adjust its height.

A region being resized.
Drag and drop the resizing button to adjust the height of the region.

When you’re happy with the region, you can click the green gear icon on the right to access custom options including picking a background color and adjusting padding. You can learn more about these settings by checking out our post Upfront Part 2: Structuring Your Site with Regions.

I’m going to change the background color to a charcoal gray, but you can customize your region the way you want. When you’re done, click the Finish editing background button.

Next, locate the menu element button displayed on the left-hand side of the editor’s menu. Click and drag it to where you want your menu to be displayed.

The menu element button on the left.
Click and drag the menu element where you want it to appear on the page.

You can choose to create a menu on a region on the top of the page as I have or you could use this same technique to display links in the footer or any other kind of menu you need on the page and on your site.

When you have included the menu item in a region, settings should appear. You can either select a pre-existing menu from the drop down box or enter a name to create a new menu.

The menu element options.
You can choose a pre-existing menu or create a new one.

If you choose a menu, it loads for you automatically. If you create a new menu, some buttons are displayed, centered at the top of the region.

In the image above, you can see the addition symbol which you would click on in your site to add a new menu item. The button beside it adjusts the padding and the gear icon has additional settings.

Click the gear button to reveal important settings on the left in the editor’s menu. Click the Add item button to create your first link in the menu.

A new menu item has been added.
Click the Add item button to create a new link.

Double click the link to change the text from New item to whatever you need it to say. Even though your link is displayed, it doesn’t have a location attached yet so clicking on it won’t do anything.

To attach a link to the item you added to the menu, hover over the text and click the ellipsis button. Click the link button to show a drop down list of your options.

Adding a link to an item.
You can add many different types of links.

You can choose from many different link options:

  • URL
  • Post or page
  • Anchor
  • Lightbox
  • Email

Some additional options may also appear that you can adjust as needed. When you’re done, click the OK button to finish creating your first link. You can click the plus button in the menu area to add another item and repeat these last few steps to add a link to them.

You can also add the styles you need to your new menu by clicking the gear icon displayed in the menu element, then click on Appearance, then on the drop down box.

The Menu Appearance settings.
You can change the styling of your menus in the settings.

You can either click a pre-existing style or create a new one by entering a name for it, then clicking Add. If you choose to create a new style, the name shouldn’t include any spaces and should be named the same way you would a CSS ID or class.

When you create a new style, options are then displayed for you to choose from including font, sizing, color, hover styles and more.

The menu styling options.
You can instantly style your menu the way you want without coding.

You can also customize your menu even further if you want with your own CSS. This isn’t necessary, but sometimes you may want to add a little something, something.

Toward the bottom of the editor’s menu on the left, you should see the Edit Preset CSS. Click on it to open the CSS editor and add what you need.

The menu styling settings.
You can choose to add your own custom CSS code if you want.

If you add your own custom CSS, be sure to click the Save button in the code editor so your changes are saved. When you’re done adjusting all the styles you need, click the Save Element button at the bottom of the editor menu to save your styles.

Your new menu should be styled, setup and ready to go, but don’t forget to click the Save button in the main editor. Otherwise, your new menu and any other changes you have made aren’t going to be saved when you navigate away from the Upfront editor.

Resources for Going Further

You now have the solid foundation you need to create additional menus for your theme and resources to help you go further. Whether you code it yourself, use a plugin or add one in Upfront, you now have a new menu on your WordPress site.

If you run into troubles using Upfront, go ahead and ask our support heroes. They can give you expert advice and support to help solve just about any problem. You can open a ticket in our support forum and we’ll be right along to help you.

For more information on how to style your new theme, there are many resources you can check out and you can find them all in our post A Mega Guide to Learning and Referencing CSS for WordPress: 150+ Resources.

You can also check out some of our other posts 10 Simple Tips for Learning CSS for WordPress, 25 Expert Tips for Cleaner CSS Coding for WordPress, 25 Pro Tips for Improving Your CSS Workflow and 5 Free CSS Plugins for Live Editing Your WordPress Site for more details on coding some CSS for your theme.

What kind of menus would you like to create? Feel free to share them in the comments below.