How to Display Featured Image below Post Title (GeneratePress Free Version)

Use the below Custom PHP Code to display featured image below the post title.

You can add the below snippets to your functions.php file or you can use the Code Snippet plugin to add the same.

Custom PHP Code

add_action( 'generate_after_entry_header','gp_custom_thumbnail_image' );  
if (!function_exists('gp_custom_thumbnail_image')) {
	function gp_custom_thumbnail_image() {  
		if(is_single()) {
			$feat_image = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
			echo '<img class="single-featured-image" src="'.$feat_image.'"></img>';	
		}
	}
}

add_action( 'after_setup_theme','gp_remove_featured_page_header' );  
if (!function_exists('gp_remove_featured_page_header')) {
	function gp_remove_featured_page_header() { 
    	remove_action( 'generate_before_content', 'generate_featured_page_header_inside_single', 10 );
	}
}

Leave a Comment