Snippet: Use Featured Image For Page Header Background
/**
* Will use the Featured image as the background when selecting the
* Background Image page header style.
*
* @link http://totalwptheme.com/docs/snippets/alter-the-page-header-style/
* @link http://totalwptheme.com/docs/snippets/post-featured-image-header-bg/
*
*/
function my_page_header_background_image( $image ) {
if ( has_post_thumbnail() ) {
$image = get_post_thumbnail_id();
}
return $image;
}
add_filter( 'wpex_page_header_background_image', 'my_page_header_background_image' );
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)
We recommend Code Snippets (100% Free) or WPCode (sponsored)