- This topic has 28 replies, 3 voices, and was last updated 3 years, 2 months ago by
David.
-
AuthorPosts
-
February 20, 2023 at 4:07 am #2539649
Charles
Hi there,
On mobile I’m trying to remove the secondary menu from sitting under the main header. Is it possible to add the secondary menu to the off canvas menu?
Any help would be greatly appreciated.
Charles
February 20, 2023 at 8:41 am #2540088David
StaffCustomer SupportHi there,
not easily, is the off canvas only on mobile ?
February 20, 2023 at 11:56 am #2540337Charles
Hi David,
Yes, the off canvas menu is only on mobile.
As an alternative method is there a way to remove the secondary menu on mobile and add a button to the off canvas menu?
Charles
February 20, 2023 at 12:11 pm #2540342Ying
StaffCustomer SupportHi Charles,
Try this PHP snippet to remove the secondary nav on mobile:
add_filter( 'has_nav_menu', 'tu_disable_secondary_nav_on_mobile', 10, 2 ); function tu_disable_secondary_nav_on_mobile( $has_nav_menu, $location ) { if ( 'secondary' === $location && wp_is_mobile() ) { return false; } return $has_nav_menu; }Adding PHP: https://docs.generatepress.com/article/adding-php/
add a button to the off canvas menu?
What’s the purpose of the button?How it should be working?
February 20, 2023 at 1:12 pm #2540391Charles
Hi there,
I’ve added the above code via the Code Snippets plugin but I can’t see that it’s worked.
I want to add a ‘Get In Touch’ link on the off canvas menu.
Charles
February 20, 2023 at 1:19 pm #2540397Ying
StaffCustomer SupportI’ve added the above code via the Code Snippets plugin but I can’t see that it’s worked.
Have you checked on your phone?
wp_is_mobile()works on the initial load, it will not work just by narrow down the browser window.And make sure the cache is cleared.
I want to add a ‘Get In Touch’ link on the off canvas menu.
You can use a block element – hook to insert this link, choose
inside_slideout_navigationhook.February 20, 2023 at 1:29 pm #2540408Charles
Hi,
Is it quite difficult to add the secondary nav in to the off canvas menu before the primary nav? This would be the best solution if it was possible?
Charles
February 20, 2023 at 5:26 pm #2540559Ying
StaffCustomer SupportIs it quite difficult to add the secondary nav in to the off canvas menu before the primary nav?
The easiest way is to create a new menu with both secondary nav and primary nav’s menu items, then assign it to the off canvas menu.
February 21, 2023 at 3:18 am #2540963Charles
Brilliant, I’ll do that.
Thank you
February 21, 2023 at 3:30 am #2540977Charles
Is the best way to turn off the secondary nav on mobile to use the PHP above?
Charles
February 21, 2023 at 5:05 am #2541067David
StaffCustomer SupportYou can use the PHP function that Ying provided.
But in addition you can add some CSS:@media(max-width: 768px) { #secondary-navigation { display: none; } }This will make sure the element is at least hidden if the
wp_is_mobiledoesn’t workFebruary 21, 2023 at 5:15 am #2541072Charles
Great, thanks David.
How is it possible to increase the logo size on mobile? I’m using navigation as a header but don’t want to increase the menu item height.
Charles
February 21, 2023 at 5:39 am #2541105David
StaffCustomer SupportTry this CSS:
@media(max-width: 1024px) { #mobile-header .site-logo.mobile-header-logo img { padding: 0; height: 25px; } }February 21, 2023 at 5:51 am #2541119Charles
Great, that worked.
Removing the secondary menu has left a white space where it was sitting. Is there a way to remove this?
Charles
February 21, 2023 at 6:56 am #2541190David
StaffCustomer SupportCan i see the site ?
-
AuthorPosts
- You must be logged in to reply to this topic.