Wordpress: Display post thumbnails in RSS Feed

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

By default wordpress does not include post thumbnails in RSS Feeds. Enable in by add this code the functions.php located inside your themes folder.

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');

URL: www.mediamilan.com

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.