Enable images in RSS feeds; it’s easier than you think

Many people think that RSS feeds are part of history. Yet even more people use RSS on a daily basis. Not only can you have your favorite websites stored in your browser, on your website or even in your WordPress admin, feeds got even more popular once smartphones took over the world. Now you can keep tracking updates from your favorite updates and authors on the go and have access to new content in seconds after a new article has been published.

Even if you’re still not into RSS feeds, once you start running your own website, you should think of those who regularly use this service. Maybe you didn’t even know, but WordPress automatically creates RSS feeds from your posts and you can get access to them simply by navigating to www.yourdomain.com/feeds.

There are different ways of manipulating RSS content in WordPress. For example, you can schedule your post for RSS feeds or you can change the way WordPress shows excerpts which effect RSS feeds as well. But no matter what you do, you still won’t have a picture attached to your RSS feed.

Imagine yourself having several websites on the same topic which regularly update their feeds. You open up your feed app (Feedly for example) on your smartphone and there is a site with having an image next to the post title, while the other has no images. In almost all cases, people will go for the link with the picture next to it because that one seems more interesting and it gives you the feel that author cares about his stuff.

Since you already have featured image attached to each post, there’s no excuse – you can have that image attached to RSS feed as well and make your website more attractive to people who use feeds.

In this article, we’re about to show you how to add featured image to your feeds. Actually, it is very simple and you will only have to copy and paste the code found below:

  1. Open functions.php file
  2. Copy and paste the code:
  3. add_filter('the_content_feed', 'rss_post_thumbnail');
    function rss_post_thumbnail($content) {
    global $post;
    if( has_post_thumbnail($post->ID) )
    $content = '<p>' . get_the_post_thumbnail($post->ID, 'thumbnail') . '</p>' . $content;
    return $content;
    }
  4. Save changes

There you go. Each post that has a featured image attached to it will now use the same image as an addition to RSS feeds. Now you can go on and try your updated RSS feed in any application you might be using. Instead of boring and plain text, you will have an image which changes the entire presentation of your site.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *