Skip to content

How to disable Header Footer on specific page

Nikhil edited this page Feb 5, 2018 · 1 revision

BB Header-Footer plugin has a dynamic filter bhf_setting_$setting which allows you to modify all the settings in the plugin.

This Wiki article will explain how this hook can be used to disable header/footer on a specific page.

/**
 * Override the Settings of BB Header Footer on specific page.
 * 
 * @param  String|int $setting Setting output.
 * @return String|int          Modified Setting output.
 */
function your_prefix_disable_bbhf_settings( $setting ) {

	// Change this to the ID of your page.
	// Refer WordPress template tags for more advanced conditions - https://codex.wordpress.org/Template_Tags
	if ( 41 == get_the_ID() ) {
		$setting = '';
	}

	return $setting;
}

// Disable Header.
add_filter( 'bhf_setting_bb_header_id', 'your_prefix_disable_bbhf_settings' );

// Disable Footer.
add_filter( 'bhf_setting_bb_footer_id', 'your_prefix_disable_bbhf_settings' );

In the above example change 41 to the ID of the page where you want to disable the Header/Footer.

Clone this wiki locally