How to show WordPress post thumbnails in feeds
Adding images to your RSS feed is a good way to give more visual effect to your articles. Below function will allow you to display post thumbnails within your RSS feed.Just add the code to your functions.php file in WP theme folder.
<?php // show post thumbnails in feeds function new_post_thumbnail_feeds($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<div>' . get_the_post_thumbnail($post->ID) . '</div>' . $content; } return $content; } add_filter('the_excerpt_rss', 'new_post_thumbnail_feeds'); add_filter('the_content_feed', 'new_post_thumbnail_feeds'); ?> |