Solved

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

Posted on 2014-12-27
5
123 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
This article discusses four methods for overlaying images in a container on a web page
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. 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 : Open Page or Post…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

867 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

20 Experts available now in Live!

Get 1:1 Help Now