In Many RSS feed we always see the images are showing. We can put the featured image in wordpress rss feed. WP RSS feeds are very important for SEO purpose. If you show the featured image on RSS feed then that will be great.
wordpress add featured image to rss feed
You need to open the functions.php file and put following code in that file. Then if you check your rss feed then RSS feed will be showing the featured images in RSS feed.
function thumbnail_in_rssfeed($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<div style="float:left;">' . get_the_post_thumbnail($post->ID) . '</div>' . $content; } return $content; } add_filter('the_excerpt_rss', 'thumbnail_in_rssfeed'); add_filter('the_content_feed', 'thumbnail_in_rssfeed');
This code will show the featured images in content and excerpt RSS feed.
Very nice post and straight to the point. I am not sure if this is in fact the best place to ask but do you people have any ideea where to employ some professional writers? Thx 🙂
Its quite simple. But did you know how to show thumbnail in custom posts rss? Thanks in advance!
10x for sharing this code. But if my theme use custom post type – listing in my case, will i must to change something in your code to work?
For example:
global $post;
if(has_post_thumbnail($post->ID)) {
with
global $listing;
if(has_post_thumbnail($listing->ID)) {
Can you tell me if i am wrong?