- This topic has 11 replies, 2 voices, and was last updated 5 years, 10 months ago by
David.
-
AuthorPosts
-
May 20, 2020 at 1:40 am #1293310
Stephen
Hello GeneratePress team,
Currently struggling to disable sticky nav on my blog posts but retain it on rest of website.
I’ve attempted to use this CSS to no avail:.single .navigation-stick,
.single #sticky-placeholder {
display: none !important;
}Please let me know what I can use to get it to work if possible!
Thanks in advance.
May 20, 2020 at 2:13 am #1293365David
StaffCustomer SupportHi there,
you can use this Filter to disable the navigation:
https://docs.generatepress.com/article/option_generate_menu_plus_settings/
For example:
add_filter( 'option_generate_menu_plus_settings','db_posts_disable_sticky_nav' ); function db_posts_disable_sticky_nav( $options ) { if ( is_single() && 'post' == get_post_type() ) { $options['sticky_menu'] = 'false'; } return $options; }May 20, 2020 at 2:48 am #1293391Stephen
Sorry I’ve completely reworded my question. My fault entirely. In fact, I actually meant the complete opposite of what I have written haha!
My stick nav currently hides itself when scrolling down. I need it to stay sticky when scrolling up and down but only on blog posts. Apologies for wording everything wrong!
Thank you.
May 20, 2020 at 3:10 am #1293415David
StaffCustomer SupportSame code applies just change the options 🙂
So in the code above replace:
$options['sticky_menu'] = 'false';with:
$options['auto_hide_sticky'] = 'false';May 20, 2020 at 3:15 am #1293421Stephen
Ok, so I’ve used the following in code snippets and I’m afraid it still isn’t working:
add_filter( ‘option_generate_menu_plus_settings’,’db_posts_disable_sticky_nav’ );
function db_posts_disable_sticky_nav( $options ) {
if ( is_single() && ‘post’ == get_post_type() ) {
$options[‘auto_hide_sticky’] = ‘false’;
}return $options;
}Presumably I need to change ‘db_posts_disable_sticky_nav’ to something else but I’m not sure what, sorry!
Thank you for your patience David
May 20, 2020 at 3:32 am #1293435David
StaffCustomer SupportThats odd. Try this.
1. In Customizer > Layout > Sticky Navigation –> Uncheck the hide when scrolling down
2. The add this Snippet:
add_filter( 'option_generate_menu_plus_settings','db_posts_disable_sticky_hide' ); function db_posts_disable_sticky_hide( $options ) { if ( !is_single() ) { $options['auto_hide_sticky'] = 'true'; } return $options; }This should now enable that feature whenever you’re NOT on a single post.
May 20, 2020 at 3:40 am #1293449Stephen
Great, that has almost solved it. Only other thing is the nav bar now slides in on blog posts but I would like it to just stay in place. Is there a way I can do that too?
Please see example – https://www.cleardesign.studio/boost-your-social-media-following/
Thanks again
May 20, 2020 at 4:09 am #1293492David
StaffCustomer SupportIn Customizer > Layout > Sticky Navigation change the Transition to None
May 20, 2020 at 4:15 am #1293502Stephen
Spot on, thats solved it thanks so much David.
May 20, 2020 at 4:20 am #1293510David
StaffCustomer SupportTry disabling autoptimize and any other cache plugins as i can still see the slide effect enabled on the site.
May 20, 2020 at 4:21 am #1293512Stephen
Sorry, I was mistaken with previous comment. All sorted now thank you
May 20, 2020 at 4:28 am #1293530David
StaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.