I have seen another question located here, but it's not useful for my case; it's not working. Also, "RSS Feed Image" plugin is not working as desired.
I want to display the first image of the post in RSS feed.
Below is the code I am using for displaying thumbnail / featured images:
//Display TZ Thumbnail in RSS
function insertThumbnailRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ) {
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'alt' => get_the_title(), 'title' => get_the_title(), 'style' => 'float:left;margin: 20px' ) ) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'insertThumbnailRSS');
add_filter('the_content_feed', 'insertThumbnailRSS');
This one is working sweet, however anything I tried for the first image is not working at all. The least I could do was display the first image URL (not desired).