Add thumbnail to WordPress rss feed without plugin

Add Tool

Add thumbnail to WordPress rss feed without plugin


WordPress rss feed is useful for creating a seo friendly website. Post thumbnail is very important to design a site specially a blog site. This thumbnails or featured image not only increase the beauty of site but also help to get visitors attractions. Personally I think it keeps visitors long time and get more page views. However in this WordPress post thumbnails tutorial I will give a snippet which will Add post thumbnails WordPress rss feed.

Add thumbnail to WordPress rss feed without plugin

How to add thumbnail to WordPress rss feed?

To add post thumbnails to wordpress rss feeds simply add the below snippet into your WordPress theme’s functions.php file. This simple piece of code will get the post thumbnail and automatically add it to your WordPress rss feed without plugin.

<?php
function devtoolsplus_rss_post_thumbnail($content) {
    global $post;
    if(has_post_thumbnail($post->ID)) {
        $content = '<p>' . get_the_post_thumbnail($post->ID) .
        '</p>' . get_the_content();
    }

    return $content;
}
add_filter('the_excerpt_rss', 'devtoolsplus_rss_post_thumbnail');
add_filter('the_content_feed', 'devtoolsplus_rss_post_thumbnail');
?>

Note: This code will work perfectly if your theme support featured image. If your theme don’t support Featured image please add featured image facility to your WordPress theme or template by following How to add Featured image in WordPress? If your Wordpress Template support featured image but you don't know how to set featured image in post follow our video tutorial How to add Featured Image in WordPress Post

Thank you for reading for more information leave a comment.


Tags: wordpress rss feed, wordpress rss, rss feed wordpress, wordpress rss feed plugin, wordpress rss feed url
Payza

About Masum Billah

Add thumbnail to WordPress rss feed without plugin Hi I am Md. Masum Billah Contributor of this website. I always like to share various things with other. In this website I am sharing web design related tips and tricks, necessary web development tools, source codes for beginner and advance web developer.


SIGN UP TO GET UPDATE TO YOUR INBOX




Discuss about: Add thumbnail to WordPress rss feed without plugin


adf.ly