Skip to content

Snippet: Automatically Display Featured Image At The Top Of Pages

function my_page_featured_image() {
	if ( is_page() && has_post_thumbnail() ) {
		echo '<div class="my-page-featured-image clr">'. get_the_post_thumbnail() .'</div>';
	}
}
add_action( 'wpex_hook_main_top', 'my_page_featured_image', 10 );
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