This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Hiding Search Bar

#51689
Ernest MarcinkoErnest Marcinko
Keymaster

Hi Kimberly,

Surely! I assume you are using a widget/block in the header, but the header is globally displyed everywhere, so you probably can’t adjust that there. However it might still be possible via a custom code.

I have looked up your home page, it’s ID is 389, so I made a custom code snippet for you, which will check the current page ID, and if it’s not 389, then will intercept the search shortcode and will not print it.

Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.

add_filter( 'asp_shortcode_output', function( $output ){
	if ( get_the_ID() !== 389 ) {
		return '';
	}

	return $output;
} );