If you’ve built your WordPress theme to use the Featured Image functionality, your RSS feed subscribers are missing part of your post.
When you use a small thumbnail, you may not think much about it. However, there may be instances where you want to include your post thumbnail. Of course, there are those WordPress theme designs that include a large wide Featured Image that can add a lot to the feeling of a post. Sure, you could simply insert the image at the top of the post, but there are some other functions you can do in WordPress by calling a posts Featured Image.
With this WordPress snippet, you can have the best of both worlds. Here’s how to add your post thumbnail/Featured Image to your RSS feed:
How-To Add Post Thumbnails to Your RSS Feed
As with many WordPress snippets, you’ll be dropping this into your theme’s functions.php or wrapping it up with your own functionality plugin.
function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '
' . get_the_post_thumbnail($post->ID) .
'
' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');
As long as your theme supports post thumbnails, you should be good to go!
[via Snipplr]
Matt Orley says
I think you’re missing a “>” in your script…
Because it blew a php error in my site.. at the &….
Let me know!
Can’t wait to use it.
Eric Dye says
THAT’S frustrating!
I just updated it, let me know!
mike says
This is a problem i have been searching for.
I set up a simple wordpress blog for a Friends wife using a child theme of twenty ten. Nothing flash but she loves it. All images used were placed at the top of each post and the posts were set to only show as excerpts on the homepage, cool, looked nice . Feedburner email subscription emails landed in inboxes showing images, great.
Then she started getting writers to write posts for her and this is when problems started. Writers were posting images in all sorts of sizes and this messed up the homepage big time. So i set things up to only allow them to use the featured image function, great homepage fixed but now in the emails sent to the feedburner subscribers there is no image at all just the text content?
Would your above solution fix this problem?
Cheers Mike
Eric Dye says
Should fix it.
On another note, as Editor of ChurchMag, I can tell you that it’s important for multi-author blogs to setup posting standards and have an Editor oversee all posts, to ensure they meet editorial standards.
Carlos says
Thanks!
Jason says
Thank you for your code example however, this has been fabricated multiple times on the internet and does not include a solution for adding your featured image inside of a custom tag in your RSS feed. In your post you say, “Sure, you could simply insert the image at the top of the post, but there are some other functions you can do in WordPress by calling a posts featured Image.” Unfortunately, your code shows that you are just adding your featured image and then your content which are nesting inside of the same RSS feed tag.