Post Thumbnail & RSS Feed: How To Improve Your Feed With an Image

StevenWordPress

Since quite some time, WordPress includes a way to set a thumbnail image for your blog posts. I make extensive use of these thumbnails in the themes I get designed for all my WordPress blogs. But what about displaying post thumbnails in your RSS Feed?

To display post thumbnail in your WordPress blog’s RSS Feed, just paste the following code in the functions.php file of your WordPress theme:

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

Learn how I made $33,543 online in the past 12 months.

Simply input your best email below to get started.

Learn how I made $33,543 online in the past 12 months.

Simply input your best email below to get started.

No thanks, I have enough money