Solved

How do I add a second menu next to the main menu in a Wordpress theme?

Posted on 2014-12-27
5
122 Views
Last Modified: 2014-12-28
I have a site here:

http://rentawebguy.com/jen/

which is a Wordpress theme.  It currently has one menu in the header that is on the right side below the logo.

I need a second menu on the left side and then both menus positioned on either side of the logo.

Attached is a graphic showing what I want it to look like.

Any help is appreciated.
header.png
0
Comment
Question by:Donnie Walker
  • 2
  • 2
5 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40519914
You have to be comfortable working with the PHP side of WordPress.  Are you?
0
 

Author Comment

by:Donnie Walker
ID: 40519937
enough to be dangerous.
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 40520164
So the instructions on how to do this are found in this Codex article:

http://codex.wordpress.org/Navigation_Menus#Register_Menus

To paraphrase (aka copy/paste shamelessly), somewhere in your current functions.php file you have some code that looks like this:

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );

Open in new window


What you need to do is alter that to make it look like this:

function register_my_menus() {
  register_nav_menus(
    array(
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' )
    )
  );
}
add_action( 'init', 'register_my_menus' );

Open in new window


That change will define an extra custom menu in your theme.  Build the menu in Appearance | Menus the normal way.  Then, in your header.php file you have something that looks like this:

<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>

Open in new window


You would place this code (or a variant of it) on the other side of the logo:

<?php wp_nav_menu( array( 'theme_location' => 'extra-menu' ) ); ?>

Open in new window


The Codex article talks about how to how better to use wp_nav_menu so you can assign different container classes to each menu to make sure you get the floats the way you want them.

You may also want to read:

http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus
0
 
LVL 28

Expert Comment

by:chilternPC
ID: 40520324
a couple of thoughts -
- it looks like you are using a theme called 'Make'  from theme foundry  which has a 'drag and drop page builder'  and maybe they have a way  of  placing the main menu and the custom menu widget in the header in the way you want?
- Web use is really switching over to smart devices/tablets where the screen is a lot smaller and  the 2 menus ether side of the logo would be only seen on a large screen
0
 

Author Closing Comment

by:Donnie Walker
ID: 40520457
Thanks Jason! That really helped.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now