Adding support for the_post_thumbnail in RSS Feeds
-
Originally posted here: https://cdharrison.com/2009/12/the_post_thumbnail-for-rss-feeds/
the_post_thumbnail
is one of my favorite additions to WordPress 2.9, but I recently ran into a problem… the images I had set as my post thumbnails weren’t being included in my RSS feed. Assuming you’ve already added support for thumbnails to your theme, you should be able to add this snippet to your theme’sfunctions.php
file to display them along with your content:function insertThumbnailRSS($content) { $content = '<p>' .the_post_thumbnail('medium'). '</p>' .$content; return $content; } add_filter('the_excerpt_rss', 'insertThumbnailRSS'); add_filter('the_content_rss', 'insertThumbnailRSS');
Thanks to Dougal Campbell for pointing me in the right direction!
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Adding support for the_post_thumbnail in RSS Feeds’ is closed to new replies.