Inspiration For Creative Minds
Home » Labs » How to show WordPress post thumbnails in feeds  

Filed under Labs

Adding images to your RSS feed is a good way to give more visual effect to your articles. Below function will allow you to display post thumbnails within your RSS feed.Just add the code to your functions.php file in WP theme folder.

 
<?php
	// show post thumbnails in feeds
	function new_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', 'new_post_thumbnail_feeds');
	add_filter('the_content_feed', 'new_post_thumbnail_feeds');
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: