Wordpress: Inject thumbnails in RSS feeds


/ Published in: PHP

Placed in the functions.php file.


Copy this code and paste it in your HTML
  1. function insertThumbnailRSS($content) {
  2. global $post;
  3. if ( has_post_thumbnail( $post->ID ) ){
  4. $content = '<p>' . get_the_post_thumbnail( $post->ID, 'medium' ) . '</p>' . $content;
  5. }
  6. return $content;
  7. }
  8.  
  9. add_filter('the_excerpt_rss', 'insertThumbnailRSS');
  10. add_filter('the_content_feed', 'insertThumbnailRSS');

URL: http://cdharrison.com/2009/12/16/the_post_thumbnail-for-rss-feeds/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.