WP Secondary Menu


Author Message
D.G

Posted: 9/21/2013
Quote message 

I have been struggling with for the past 2 weeks.

I am working on site for a client, a Christian Drama Ministry (www.fregift.com.ng). They have a long list of menu items which I decide to slit it up into different navigation menu bar as seen or displayed on the site right now.

NOW MY CHALLENGE
I have registered in my theme’s function 2 menu names as this:


(register_nav_menus(array('primary-menu' => __('Primary Navigation', THEME_NS)));
register_nav_menus(array('secondary-menu' => __('Secondary Navigation', THEME_NS)))


And also created the 2 menu names in my “WP>Appearance>Menu” too.

WHAT I NEED
I want the 2nd Navigation Menu with registered name (Secondary Navigation) to have different menu-items. But unfortunately the 2nd navigation bar (i.e secondary nav) is still showing the same menu-items as the primary nav-bar instead of the menu-items I added or assigned to it backend @ APPEARANCE>MENU.

Please can anyone help with it appropriately?
 
Trevor

Posted: 9/21/2013
Quote message 

You need to call this function with secondary-menu as your menu instead of primary-menu. This is usually found in the header.php, but you'd put it wherever you wanted your second menu.

echo theme_get_menu(array(

'source' => theme_get_option('theme_menu_source'),
'depth' => theme_get_option('theme_menu_depth'),
'menu' => 'primary-menu',
'class' => 'art-hmenu'
) );

 
Nick

Posted: 9/21/2013
Quote message 

You also emailed me privately emailed me about this, and asked you to send me the exported theme. In the meantime these are the steps to create s second horizontal menu.

1. Open the header, and copy the entire <nav> section, to the appropriate place to display the second menu. You have to rename this second menu, otherwise you will have 2 menus, displaying the same menu items. So, in this <nav> section look for the line "'menu' => 'primary-menu',", and rename it to the same name that you define in the functions.php file. I name my second menu as "secondary". This part is to simply display the 2nd menu in your theme.

2. You need to declare the second menu, in order to be able to use it. You do that in the functions.php file. Find the primary menu declaration, and just below that add (assuming that you are naming the second menu as "secondary"):

register_nav_menus(array('secondary-menu' => __('Secondary Navigation', THEME_NS)));

Finally, create the custom menus (Appearence->Menus), and assign one menu to the primary, and the other to secondary.

Reading your post, I'm guessing that you failed to do setp 1 properly. Make sure you rename the second menu instance in the header.php file accordingly. But again, if you email me the finished theme, I can fix it within a few seconds... I hope that helps.
 
Nick

Posted: 9/21/2013
Quote message 

Sorry, Trevor, we were posting at the same time I guess...
 
D.G.

Posted: 9/21/2013
Quote message 

Sorry Nick and Trevor, I forgot to tell you that I also echo the "NAV" in the theme "HEADER.php" too. I actually got my second nav working except it is not display the correct menu-item-list that I have assigned to it backend @ APPEARANCE>MENU.

For example: I want. PRIMARY MENU to have these menu items like : home - drama-- books - audio plays

SECONDARY MENU: Prayers and Needs, contacts News

BUT I GET
For example: PRIMARY MENU: home, drama, book and audio

SECONDARY Menu: PRIMARY : home, drama, book and audio

NOTE
Please note that I have assigned to them backemd APREARANCE>MENU


 
Nick

Posted: 9/21/2013
Quote message 

Make sure that in the header.php file, each menu is labeled correctly, as both Trevor and I posted above. Read what Trevor typed, and read again my first point.
 
Monty

Posted: 9/21/2013
Quote message 

I used 2 horizontal menus on this site. It was awhile ago so I can't remember all the details (I will have to go back into the files). I created 2 identical sites except for the menu positions then I merged them together. You have to find and change all name references of one of the menus so that both menus don't conflict.
This is how it came out,

www.dmnphoto.com

notice that there is a menu in the upper right and a menu just below header.
 
Nick

Posted: 9/21/2013
Quote message 

Good job Monty. Yes, you have to rename the classes if the menus are different. And yes, it is best to create 2 templates and merge them, while changing the class name for one of them. However, if the menus are the same, you don't have to, thus it's easier to create the menus.

With your type of menu, the real challenge is with the responsive views. I do understand why your theme is not responsive.
 
Nick

Posted: 9/21/2013
Quote message 

I don't have any themes online to show you, but I have a couple of them locally, so the next best thing I can do is to show a video of them. In both cases, I simply duplicated the menu bars, so each was a 10 minute job. The first one was done with Art. 4.2 beta, and the second one with Art. 4.1 + Templateer. Also notice that in some pages, the header is removed from the backsite. For those pages, the second menu also gets removed. In both cases the responsive menus work just fine.

http://www.youtube.com/watch?v=1tuKyID2Ta0&feature=youtu.be
 
Trevor

Posted: 9/21/2013
Quote message 

If you've set everything up correctly on the programming side then the only thing that could be causing this is if you have no menu set for the Primary Menu area in Appearance -> Menus and under the Manage Locations tab. Otherwise the Artisteer template will use pages or categories for the menu, and this setting will apply to all menus without a custom menu applied.

To get around this if you want to leave the Primary Menu alone and force the secondary menu to use a custom menu, you can change
'source' => theme_get_option('theme_menu_source'),
to
'source' => 'Custom Menu',
from the theme_get_menu function call in the code I posted earlier.
 
Trevor

Posted: 9/21/2013
Quote message 

Excuse me, edit for the above: Not setting a custom menu in the Primary Menu area will force either pages or categories to supply the menu items for your menu for EVERY menu used with the Artisteer theme_get_menu function, unless you make the change I stated above, which will force a custom menu for that menu area.
 
D.G.

Posted: 9/23/2013
Quote message 

Thank you guys, i now have it working.

couple of things i did wrong:

(1) my artisteer exported theme name had "_" (fgnewest_sidebar). Nick once advised me against this but i dont know why i did it again. naughty anyway...
(2) i didnt add theme location to my custom menu.

As soon as i did the above, i got a 2 working menu bar.

Once again, thank you Nick, Trevor and Monthy for your kind response.
 
Nick

Posted: 9/24/2013
Quote message 

Thank God D.G., because I did not have time to look at the theme you had emailed me, and now I feel better.
 
Hakan

Posted: 2/16/2014
Quote message 

Hello there! So I have been messing around a bit, don't know if I have it right? http://therioforum.com/gringo-rio/

Only thing now is that I want to change size of font, colours and also not make the submenus on the primary navbar (mega menu) be hidden by the secondary menu.

I don't know if it is possible, to get an idea: http://riotimesonline.com/

Many thanks!

Hakan

 
Hakan

Posted: 2/17/2014
Quote message 

Addition:

So I have been messing around a bit and can't get it to work. I know where the theme is for the navbar, but not where it is for the custom secondary navbar... I tried to make a custom primary menu as suggested, but it doesn not accept all my items (is there a limit?)





 
Hakan

Posted: 2/17/2014
Quote message 

2nd addition:

So, in the header.php I have added:

<nav class="art-nav">
<?php
echo theme_get_menu(array(
'source' => theme_get_option('theme_menu_source'),
'depth' => theme_get_option('theme_menu_depth'),
'menu' => 'secondary-menu',
'class' => 'art-hmenu'
)
);
get_sidebar('nav');
?>

I was guessing that in this code it would call the layout from the style.css file. I made another theme with the menu I wanted and copied this code in to the style.css

.art-navv
{
background: #97B9BF;
background: -webkit-linear-gradient(top, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
background: -moz-linear-gradient(top, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
background: -o-linear-gradient(top, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
background: -ms-linear-gradient(top, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
-svg-background: linear-gradient(top, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
background: linear-gradient(to bottom, #81A9B1 0, #A3C1C7 40%, #A6C3C9 50%, #A3C1C7 60%, #81A9B1 100%) no-repeat;
margin:0 auto;
position: relative;
z-index: 499;
text-align: left;
}

Howe can I call this layout to the menu, I guess it is by changing the code in the header.php I have added?

PS And still then I would have the problem with that the secondary menu overlaps the megamenu sub items....

Any ideas?


 
Allan

Posted: 10/25/2014
Quote message 

Hi Guys
Hoping somebody can help out a little here. Got the second menu working great, but two issues with it.

The links are displayed as a list and the text colouring is all wrong. I am guessing its all in the css file, but for the life of me cant find the correct coding to duplicate and edit to get the effect we are after.

We simply wanted white text, with basic dashed separator across the page rather than down the page.
Thanks
Allan