Skip to content

Snippet: Conditionally Disable Fixed Header/Menu

The sticky header can be enabled and disabled globally via the Customizer but if for some reason you need to disable the sticky header conditionally you can use the "totaltheme/header/sticky/is_enabled" filter. This may be useful if you have a section of your site where a sticky header doesn't make sense.

// Conditionally Disable Fixed Header/Menu
add_filter( 'totaltheme/header/sticky/is_enabled', function( $bool ) {
	if ( is_front_page() ) {
		$bool = false; // disable on the front page of your site.
	}
	return $bool;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top