Created
January 28, 2016 15:41
-
-
Save javiergbas/573cecb8fd9cb493a878 to your computer and use it in GitHub Desktop.
Add post thumbnails to RSS feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add post thumbnails to RSS feed | |
function 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', 'rss_post_thumbnail'); | |
add_filter('the_content_feed', 'rss_post_thumbnail'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment