HomeTips & TricksWordPressHow to Add Featured Image in WordPress RSS Feed ?

How to Add Featured Image in WordPress RSS Feed ?

One of the first things I do at whatever point I introduce a new form of WordPress is to empower emphasized pictures to appear in my RSS channel.  Add Featured Image in WordPress RSS Feed , While some individuals may think RSS channels are dead, they are still utilized by many administrations.
Take after the steps to add emphasized pictures to your RSS Feed in WordPress:

Step 1 :

We have to add some code to your functions.php record, so first go to the appearance editor , then Scroll down and find your functions.php file in right side of your Screen

wordpress appearance editor

Step 2:

At that point put the accompanying code at the base of your functions.php document (If you don’t realize what you are doing, make beyond any doubt to reinforcement your functions.php record before altering it)

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
 
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

Step 3:

In the above code we utilized medium for the thumbnail size. This will show up like our RSS channel underneath. You could change this to thumbnail or full on the off chance that you favor. Medium appears to work the best for all stages.

LIVE DEMO

Techniblogic
Techniblogichttps://techniblogic.com/
Get Top Technology Reviews and Updates . Techniblogic provide you the Top Tech Reviews of Latest gadgets as well as Tech Guide.

Latest Articles

Exclusive Article

How to Find Instagram Trending Reels Song [4 Only Ways]

Looking for Instagram Trending Reels Song to create your own trending Instagram reels? Don't worry! Here are the best ways to find Instagram Trending...

4 COMMENTS

  1. Hey there! Any ideas in order to change the order.. rather than title, then image..1st Image
    and 2nd Post Title ?

  2. It was really a headache to see the RSS-to-email campaigns without no images because the RSS feed did not have the necessary tag to pull images from. Anyway, changed the functions.php file and now MailChimp can pull the required components and now the emails look beautiful.

    However, still the images in RSS feed look really big and wish to resize them to a suitable size. Needs to search more and find a solution for this.

LEAVE A REPLY

Please enter your comment!
Please enter your name here