We create beautiful & user-friendly websites and provide quality web development services worldwide.
Contact us to get started on your project.


How to Add Featured Images To Your WordPress RSS Feed Excerpts

Published by Veron Ang | Leave a comment


In WordPress RSS feeds, we have the option to display either Full Text or Summary. This can be changed in WordPress Admin > Settings > Reading page.

As the name suggests, Full Text displays the posts in entirety, whereas Summary displays a text excerpt for each post in your RSS feed. While functional, the latter is not exactly the most elegant looking.

To beautify the Summary feed a little, I like to display the post’s Featured Image just above each excerpt after the title. To see an example, view http://sparklette.net/feed in your RSS feed reader.

Add the Post Featured Image to your WordPress RSS feed

To do this, simply add the following function to your theme functions.php file, after the opening <?php tag.

function sparklette_rss_thumb($content) {
	global $wp_query;
	$postid = $wp_query->post->ID;

	if (has_post_thumbnail($postid)) {
		$image = wp_get_attachment_image_src( get_post_thumbnail_id( $postid ), 'large' );
		$thumb = $image[0];
	} elseif (get_post_meta($postid, 'thumb', true)) $thumb = get_post_meta($postid, 'thumb', true);
	else {
		$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wp_query->post->post_content, $matches);
		$thumb = $matches [1] [0];

	if(is_feed()) {
		if($thumb !== '') {
		$content = '<img src="' . $thumb . '" /><br /><br />' . $content;
	else {
		$content = $content;
	return $content;
add_filter('the_excerpt_rss', 'sparklette_rss_thumb');
add_filter('the_content', 'sparklette_rss_thumb');

About the Author

Veron Ang is a , developer and WordPress expert at Sparklette Studio. She has been building websites for as long as she can remember, and graduated with a bachelor's degree in computer science from the National University of Singapore.

Leave a comment