add thumbnails to rss feeds


/ Published in: PHP
Save to your folder(s)



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.