Site logo

Archived topic

Disable sticky header navigation while scrolliong on blog posts

11 replies · Started by Stephen on May 20, 2020

Viewing posts 1–12 of 12

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.

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.

Same code applies just change the options :)

So in the code above replace:

$options['sticky_menu'] = 'false';

with:

$options['auto_hide_sticky'] = 'false';

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

Thats 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.

In Customizer > Layout > Sticky Navigation change the Transition to None

Spot on, thats solved it thanks so much David.

Try disabling autoptimize and any other cache plugins as i can still see the slide effect enabled on the site.

Sorry, I was mistaken with previous comment. All sorted now thank you

Glad to hear that

This archived topic is closed to new replies.