Site logo

Archived topic

Sticky Navigation only on Home Page

3 replies · Started by Gary on March 12, 2018

Viewing posts 1–4 of 4

Is there a way to set the sticky navigation to function only on a set of pages?
That is, I do not want it to function on home page but I want it on all others.

Thanks.
Gary

Hi there,

With the sticky navigation turned on in the customizer, add this addtional snippet:

add_filter( 'option_generate_menu_plus_settings','lh_exclude_home_sticky_menu_setting' );
function lh_exclude_home_sticky_menu_setting( $options ) {
	
	if ( is_front_page() ) {
		$options[ 'sticky_menu' ] = 'false';
	}
	return $options;
}

Adding PHP: https://docs.generatepress.com/article/adding-php/

Hi wonderful support team. In the same topic.

How to exclude all "single pages" from sticky nav?

Hi there you can change the if ( is_front_page() ) { conditional to if ( is_page() ) { this will target all single pages ( not posts )

This archived topic is closed to new replies.