Skip to content

Snippet: Site-Wide Overlay Header Style and Page Header Background Image

Important: You can now enable the Transparent/Overlay Header site wide via the Customizer so this code is no longer needed!
// Enable overlay header site-wide
add_filter( 'totaltheme/header/overlay/is_enabled', '__return_true' );

// Overlay header style
add_filter( 'totaltheme/header/overlay/style', function( $style ) {
	$meta = get_post_meta( get_the_ID(), 'wpex_overlay_header_style', true );
	return $meta ? $meta : 'dark';
} );

// Change the page header style
add_filter( 'totaltheme/page/header/style', function( $style ) {
	return 'background-image';
} );

// Change the page header background image
add_filter( 'wpex_page_header_background_image', function( $image ) {
	return 'YOUR IMAGE URL';
} );
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