Archived topic
Second Menu
16 replies · Started by Dries on December 12, 2016
Hi Tom,
I have a question.
At first a site had only one top menu, now the person wants 2 different menus. They want to be seen as 1 company with 2 subitems. Interior(head) - Wood(sub1) -heating(sub2)
for the menu changing i used "Menu Swapper" plugin. Now there is a problem with the mobile view on the contact menu subitems(info and contact form)
Do you have any suggestion or do you know the problem with this plugin?
Thanks!
Hi there,
Unless I misunderstand what you are after, you should be able to create a second menu/navigation without the plugin.
Go to Appearance > Menus and create a new menu with the items you want, then click the "Manage Locations" tab and assign the newly created menu to "Secondary Menu".
Then you can customize it in Customizer > Layout > Secondary Navigation.
Let me know if this is what you are looking for :)
Hi Leo,
I think you misunderstand :-). For example, I want "Primary menu 1" on Page1 and "Primary menu 2" on Page2.
So I don´t want 2 menu´s on one page. But two different primary menu´s. With this it´s possible to create 2 sites with different content and menu in one Wordpress site.
I hope this explanation is more clear then my first :)
I think Menu Swapper might be your best bet - what exact issues were you having with it?
Alternatively, you could use a plugin like this and switch out individual menu items: https://en-ca.wordpress.org/plugins/if-menu/
Hi Tom,
I´m using now menu Swapper. The problems i see is: (normal desktop view)No Arrow on the second menu item with submenu items. When you view the site with a mobilephone, there is no dropdown of submenuitems.
Can I send you the link? For me this is a security threat by publicly saying what you use on that site.
You can send the link through the Contact page here: https://generatepress.com/contact/
The next version actually improves how the dropdown arrow is displayed.
If you're comfortable with altering core files, open navigation.php and find: https://github.com/tomusborne/generatepress/blob/1.3.41/inc/navigation.php#L196-L226
And replace it with: https://github.com/tomusborne/generatepress/blob/master/inc/navigation.php#L196-L223
I'm hoping this change will fix compatibility issues with some plugins like you're describing.
Hi Tom and Leo
I tried the suggested replacement, but this didn´t fix my problem.
It´s something with the menu swapper I think. When I add the same menu item with dropdown like in the default layout, the problem stays.
Hmm that's a shame, I had high hopes for that updated code! :)
You may need to settle with a plugin like this: https://en-ca.wordpress.org/plugins/if-menu/
I'll take a look at menu swapper and see if I can spot the issue.
Hi Tom,
I tried If-Menu. I can´t accomplish the task with this plugin. You cannot say, hide if you are on this page. :(
Hi Tom and Leo,
I tried "Page Specific Menu Items" okay, plugin works but, yeah but :).
The image gallery creates a new page, so you have to go there and set the menu for every page :( That´s not so fun. I know people, they forget this things :-).
Is there another way to do this? for example: http://wordpress.stackexchange.com/questions/150209/how-can-i-display-a-menu-on-certain-pages-only
Thanks!
Here's how to do it with Menu Swapper.
1. Create your new theme locations for your new menus:
add_action( 'init', 'tu_register_menus' );
function tu_register_menus() {
register_nav_menu( 'first-menu', __( 'First Menu' ) );
register_nav_menu( 'second-menu', __( 'Second Menu' ) );
register_nav_menu( 'third-menu', __( 'Third Menu' ) );
}
Those will allow Menu Swapper to work in the first place.
2. Then we need to tell our arrows to work in these new theme locations:
add_filter( 'generate_menu_arrow_theme_locations','tu_gp_dropdown_arrow_locations' );
function tu_gp_dropdown_arrow_locations( $theme_locations ) {
$theme_locations[] = 'first-menu';
$theme_locations[] = 'second-menu';
$theme_locations[] = 'third-menu';
return $theme_locations;
}
Tested and working :)
Hi Tom, This need to be done in the GP Navigation.php? or do I add this in a GP hook?
What with future updates?
Thanks!
This should help: https://generatepress.com/knowledgebase/adding-php-functions/