How to Add Thumbnails to Your RSS Feed

Tutorials | By Andy | 2 September 2010 | Comments 0

There are more and more blogs adding thumbnails to their RSS feed. This looks nice and can set your RSS feed apart from others. You should be able to implement this within 10 minutes or so. WPZine has made this modification.

To add thumbnails to your RSS feed all you need to do is copy and paste the following into your theme’s functions.php file:

//Add thumbnails to RSS feed

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

The functions.php file can be found in /wp-content/themes/ThemeName/functions.php.

As you can see this is a fast and simple modification you can use to enhance your blog’s RSS feed.

Andy

Andy is a WordPress enthusiast and founder of WPZine. You can follow him on Twitter @andycrofford.

Visit Andy's website

Leave A Comment.