Crucecita Enabling post thumbnail on RSS feed could increase content rate of consumption just as a compelling featured image can attract or pull audience to blog post.

For instance, if you use Feedly to read content from different sites, you’ll attest to the fact that rss feed content with image tends to have higher engagement and click-through-rate (CTR) than all-text content.

People are drawn by images especially those that are attractive and also resonate with both the post title and body.

That’s just the way we are wired. This suggestive submission plays out significantly on social media platforms.

If it is therefore good to enable post thumbnail on RSS feed, how do we go about it?

Guessed, that’s the question you were about to ask me. Great!

The answer to that question is what this post is set to achieve. I’ll be taking you through two different ways by which you can get this done:

The Āmol code and plugin methods. Let’s start with the code method.

How to enable featured image on RSS feed

Technically speaking, WordPress does not add post thumbnail to blog post. You have to set it outside the WordPress post editor.

And the image you upload within the post editor cannot be treated or function as post thumbnail except you set another function to call the first image within post to behave like featured image.

These explained briefly why the images within blog post can not show up as part of the excerpt on RSS feed.

You have to call it as attachment just as it is on blog post.

Fortunately, WordPress has template tag you can call for this purpose and then use it at the right loop.

The template tag use to call featured image goes thus;


<?php the_post_thumbnail(); ?>

We shall use this tag to wrap thumbnail images on rss feed content.


function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '


<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 5px;' ) ) . '</div>



' . $content;
}
return $content;
}

add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

All you need to do from here is to copy and paste this code at the bottom of your active theme’s functions.php file.

NOTE: It may take awhile before the images propagate on your feed.

However, you can really modify the code to suite your purpose and then include some style.

For instance, the code above will place the post thumbnail at the top of the feed 5px between the post excerpts just like we have it on our blog feed.
Frandimore Feed
If you want the image to come after the excerpt, the code will change to this;


// show post thumbnails in feeds
function diw_post_thumbnail_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = $content . '


<div>' . get_the_post_thumbnail($post->ID) . '</div>



';
}
return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');

The one that interest me most is the ability to link the thumbnail to the full blog post.

If that is what you would prefer, the code you need is;


// show post thumbnails in feeds
function diw_post_thumbnail_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = $content . '


<div><a href="' . the_permalink($post->ID) . '">' . get_the_post_thumbnail($post->ID) . '</a></div>



';
}
return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');

Update: We discovered that this code needs further modifications. So, use it with care.

You may also choose to wrap the excerpt around the image.

To do this, you’ll need to just remove the ‘<div>‘ because that’s what makes the content to move to the next line.


// show post thumbnails in feeds
function diw_post_thumbnail_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = get_the_post_thumbnail($post->ID) . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');

Plugin Method

A plugin called “Featured Images in RSS w/size and Position” will help you perform virtually all the functions enumerated above without having to touch a line of code.

If you know your site can still accommodate additional plugin without compromising site speed and security, then you are good to install this plugin.

Apart from adding feature image at the top of your rss feed (which is the default position), it has the capacity to set the image below the feed content or wrap it around the content.

You also have the option to customize the size of the image apart from the default set; thumbnail, medium or large.

You can do all these on the setting page of the plugin after installation.

To install the plugin, simply go to the plugin page here on WordPress plugin repository.

Download it and then upload the zip file into your site or upload the unzip folder through FTP provision (File manager) on your cpanel or through other file managers like Filezilla.

You may download our eBook on how to install plugin like a pro for details.

Upon activation, you will have to access the setting page by going to “Setting” on your WP dashboard.

Click on the plugin name (Featured Images in RSS w/size) and set it the way you want it to display your featured images on rss feed.

Don’t forget to save your settings.

You may have to wait for awhile for the image to propagate or you may try to clear your cache on browser and then reload your feed page.

Conclusion: You can see how easy and simple it is to add images on your rss feed especially if you opt for plugin method where you do not have to tamper with code.

The customization options too are phenomenal giving you wider range of flexibility on both methods- code and plugin.

It is my hope that you’ll find this tutorial useful to add images that will boost the rate at which your targeted audience read your content on RSS feed because you never can tell the mode in which your blog post readers consume your content or the extent the syndicated feed has gone. What do you think?

Francis 'Toke
Shares
Share This