Home Tips & Tricks WordPress How 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

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

Latest Articles

Asus Strix G531GT Review

4 Frequent Laptop Problems and How to Overcome Them

0
Having a laptop is a blessing in disguise, whether you consider laptop rental in Chennai or make a new purchase. But more or less,...
Investments In The Digital Age

High Risks and High Rewards: Investments in the digital age

0
Investment opportunities that offer a fast turnaround with high profits are generally accepted as high-risk. While long-term investments can allow for increased stability and...
Huawei GT2 launched in india

Huawei launches GT2 smartwatch in India, starting at Rs 14,990

0
Huawei, a leading global provider of information and communications technology, has launched its much-anticipated smartwatch, the Huawei Watch GT 2. This watch comes with 2...
MG ZS Electric SUV Unveiled In India

MG ZS Electric SUV Unveiled In India : Features & Specification

0
MG Motor India has launched the first electric vehicle in India named as MG ES EV. This vehicle is directly unveiled from the company’s...

Top Deals