Feature Image in a Post

Hi! I’m using Travelify Theme and i’m enjoying it! But I’m having a problem to display the feature image inside the post. I looked for the forum and wasnt able to find any help. How do I display the feature image inside the post below the title post?

www.trackingtrip.com.br if it helps.

Thank you very much!

Hi @cryzon,

I hope you are well today and thank you for your question.

You can display the feature image inside the post below the post title by using the attached small plugin containing the following code.

function travelify_after_post_meta_add_image(){
	if( is_single() ){
		$image = '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
		$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
		echo $image;
	}
}
add_action( 'travelify_after_post_meta' , 'travelify_after_post_meta_add_image');

Best Regards,
Movin

Hi @movin,

Thank you for your answer.
I tried to upload this file into the plugin pannel at Wordpress and I got the following erro: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to find End of Central Dir Record signature

Do I have to post this code inside some .php file, such as functions.php?

I’m new at WordPress and still learning.

Hi @cryzon,

The shared plugin is getting installed and working fine for me as shown in the attached screenshot.

You can alternatively just extract the file colorlib-plugin.php from the shared zip file and add it in the directory wp-content/plugins of your WordPress install and then activate the plugin.

Instead of using plugin, you can just add the above shared code in the functions.php file of your child theme.

Best Regards,
Movin

Hi @movin,

Thank you very much, it works!

I tried to unzip it and then upload to the plugin panel, my bad!

You are most welcome here :slight_smile: