- This topic has 9 replies, 4 voices, and was last updated 1 year, 8 months ago by
Leo.
-
AuthorPosts
-
May 6, 2019 at 9:43 pm #891315
José
Hi there, I have enabled sticky browsing on the desktop and mobile.
I would like to leave the navigation bar fixed only on the product page in the mobile version … how can I do it?The attention is appreciated.
May 7, 2019 at 2:02 am #891463David
StaffCustomer SupportHi there,
you can use the Menu Plus Options:
https://docs.generatepress.com/article/option_generate_menu_plus_settings/
Woocommerce uses the
is_product()
conditional tag for the single product page.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 7, 2019 at 2:52 pm #892260José
Hi David, the plus menu does not respond to the mobile header (appearance / customize). enyway I added the following code to the son theme:
add_filter( 'option_generate_menu_plus_settings', 'lh_custom_homepage_menu_plus_settings' ); function lh_custom_homepage_menu_plus_settings( $options ) { if ( is_front_page() ) { $options['mobile_header_sticky'] = 'disable'; } return $options; }
…but the site breaks with the filter.
What am I doing wrong?
Thanks
May 7, 2019 at 4:53 pm #892328Tom
Lead DeveloperLead DeveloperI just adjusted the code in your post. Can you re-copy/paste it and let me know if it works?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 7, 2019 at 7:42 pm #892373José
Hi Tom, I added the code and it works fine, but it only works on the home page, on the product page it had no effect …
The attention is appreciated.
May 8, 2019 at 2:44 am #892611David
StaffCustomer SupportIn this code change:
is_front_page()
to
is_product()
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 8, 2019 at 12:47 pm #893339José
Hi David works perfect.
Just to know, if I need to also configure the navigation in the home.
To add is_front_page () and is_product () in the same filter code
This is the correct way to do it?:add_filter( 'option_generate_menu_plus_settings', 'lh_custom_homepage_menu_plus_settings' ); function lh_custom_homepage_menu_plus_settings( $options ) { if ( is_front_page() ) { $options['mobile_header_sticky'] = 'disable'; } if ( is_product() ) { $options['mobile_header_sticky'] = 'disable'; } return $options; }
Thanks for your time
May 8, 2019 at 1:45 pm #893385Leo
StaffCustomer SupportYou can combine them like this:
add_filter( 'option_generate_menu_plus_settings', 'lh_custom_homepage_menu_plus_settings' ); function lh_custom_homepage_menu_plus_settings( $options ) { if ( is_front_page() || is_product() ) { $options['mobile_header_sticky'] = 'disable'; } return $options; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 8, 2019 at 2:12 pm #893415José
Hey Leo, Thanks for your answer, I will leave it annotated …
Regards
May 8, 2019 at 5:26 pm #893534Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.