Display post thumbnail in your RSS feed

by Hieu Martin on August 7, 2010

Introduced in WordPress 3.0, get_the_post_thumbnail() allow you to display a thumbnail in your posts. But what about displaying post thumbnails in RSS feeds? Just read this recipe to know how to do.

Simply paste the following code in your functions.php file. The post thumbnail should be visible once you saved the file.

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');

Thanks to Jeff Starr for this great tip!

Did you enjoy this article? Give us some link love, and don't forget to bookmark this page on Delicious.

Notes : Join us and read the Guidelines to submit your guest posts.
Subscribe free updates via: RSS Feed | Email | Twitter

Related Articles

{ 7 comments… read them below or add one }

1 SQL Training August 7, 2010 at 8:56 am

Thanks a lot for sharing this bro. Does this show in feedburner feeds too?

Reply

2 Hieu Martin August 7, 2010 at 9:19 am

Hi friend. This tips not show in feedburner feeds

Reply

3 Dean Saliba August 7, 2010 at 10:21 am

Oh that is a shame. I have Feedburner and would love for something to show thumbnails. :(

Reply

4 Michael August 7, 2010 at 6:12 pm

Yea, that would be awesome to have thumbnails on feedburner. To bad, anyway nice tip though.

Reply

5 Hieu Martin August 8, 2010 at 2:09 am

@Michael Yes too bad because this tips can display thumbnails on feedburner

Reply

6 Marty August 7, 2010 at 11:25 pm

Thank you for this great tip, I was looking to thumb to the my RSS feed, makes it more attractive :)

Reply

7 Hieu Martin August 8, 2010 at 2:09 am

Hi Marty.
Glad you like it.

Reply

Leave a Comment

Previous post:

Next post: