- This topic has 7 replies, 4 voices, and was last updated 6 years, 11 months ago by Leo.
-
AuthorPosts
-
April 3, 2016 at 7:07 am #183825leo
Is it possible to use a different menu for mobile?
April 3, 2016 at 10:56 am #183855TomLead DeveloperLead DeveloperIt depends.
If you’re using the Slideout menu, you can set it as a theme location in “Appearance > Menus”.
If you’re using the Mobile Header, there’s a simple filter I can provide.
If you’re using the default mobile menu, I’m afraid it uses the same menu as desktop.
Let me know ๐
April 3, 2016 at 11:22 am #183868leoI know. I used the Slideout menu first, but the dropdown for submenus only works when you click on the arrow precisely (on mobile). So I switched back to the default menu, where you can hit the bar anywhere to get the dropdown.
It’s not a very big deal, but if it’s not too much trouble, I would be interested in your filter.
Thanks Tom!
Edit for Tom: the menu you see on the homepage is the menu for visitors. Logged in users have many more options.
- This reply was modified 8 years, 6 months ago by leo.
- This reply was modified 8 years, 6 months ago by leo.
April 3, 2016 at 11:33 am #183877TomLead DeveloperLead DeveloperThe mobile menu should act the same regardless of slideout vs regular. If your menu item has # as the URL, you should be able to tap the entire item to initiate the dropdown. This is a feature in the latest version.
To create a new theme location for the mobile header, you need to do something like this:
add_action( 'init', 'generate_register_mobile_menu' ); function generate_register_mobile_menu() { register_nav_menu( 'mobile-menu',__( 'Mobile Menu' ) ); }
Then you need to add this:
add_filter( 'generate_mobile_header_theme_location', 'generate_change_mobile_header_menu' ); function generate_change_mobile_header_menu() { return 'mobile-menu'; }
Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/
- This reply was modified 8 years, 6 months ago by Tom.
April 3, 2016 at 11:52 am #183881leoWow man, this is Support 3.0. The # did the trick.
Thanks a million!
April 3, 2016 at 11:52 am #183882TomLead DeveloperLead DeveloperYou’re welcome ๐
November 8, 2017 at 10:58 am #418680SamuelI’d like to ask a related question here, even though the thread is more than a year old.
I created a new menu (“TestMenu”) that is not assigned to any of the three locations (Primary, Secondary, or Slideout). I would like to use “TestMenu” as my mobile menu instead of the default, which is the Primary menu.
I added the two code snippets provided above, and I now have “Mobile Menu” under Appearance->Menus->Manage Locations, and I can select my “TestMenu” as an option.
But I don’t know what to do next. The Primary menu still shows up in the mobile context. Are there additional steps, or is what I’m trying to do not possible?
Thank you —
November 8, 2017 at 11:32 am #418715LeoStaffCustomer SupportHi there,
Best way is to assign the new menu to be slideout menu, then activate it for mobile only:
https://docs.generatepress.com/article/activating-slide-out-navigation/ -
AuthorPosts
- You must be logged in to reply to this topic.