Family Encyclopedia >> Electronics

How to add post thumbnails to your WordPress RSS feeds

In our previous tutorial, we showed you how you can add post thumbnails in WordPress. The sad truth is that even if you enable post thumbnails, they won't appear in your RSS feeds. But we have a solution for that. In this article, we will show you how you can add post thumbnails to your WordPress RSS feeds with a simple function.

All you have to do is open your theme functions.php File and add the following code:

 function rss_post_thumbnail ($ content) global $ post; if (has_post_thumbnail ($ post-> ID)) $ content = '

'. get_the_post_thumbnail ($ post-> ID). '

'. get_the_content (); devolver $ contenido; add_filter ('the_excerpt_rss', 'rss_post_thumbnail'); add_filter ('the_content_feed', 'rss_post_thumbnail');

Feel free to style this however you like. Remember to enable WordPress post thumbnails using our main WordPress post thumbnails tutorial before adding them to your RSS.

Source:Dave Redfern