Site logo

Archived topic

fixed navigation bar on product page in mobile view

9 replies · Started by José on May 6, 2019

Viewing posts 1–10 of 10

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.

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

I just adjusted the code in your post. Can you re-copy/paste it and let me know if it works?

In this code change:

is_front_page()

to

is_product()

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

You 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;
}

Hey Leo, Thanks for your answer, I will leave it annotated ...

Regards

No problem :)

This archived topic is closed to new replies.