ubermenu_sticky_apply

Knowledgebase Docs » UberMenu Sticky
USEFUL? 0
UberMenu 3

The ubermenu_sticky_apply filter allows you to enable or disable sticky functionality based on your custom conditions.

Set $apply_sticky to false to disable the sticky functionality or true to enable it.

Here’s some example code with two examples.

function um_alter_sticky( $apply_sticky , $config_id ){

	//Just target the main configuration
	if( $config_id == 'main' ){

		//Example 1: Disable UberMenu Sticky on Page ID 326
		if( is_page( 326 ) ){
			$apply_sticky = false;
		}

		//Example 2: Enable UberMenu Sticky on front page only
		if( is_front_page() ){
			$apply_sticky = true;
		}
		else{
			$apply_sticky = false;
		}

	}

	//Always return $apply
	return $apply_sticky;
}
add_filter( 'ubermenu_sticky_apply' , 'um_alter_sticky' , 10 , 2 );