Skip to content

Instantly share code, notes, and snippets.

@rugor
Last active January 19, 2016 21:30
Show Gist options
  • Save rugor/5417954 to your computer and use it in GitHub Desktop.
Save rugor/5417954 to your computer and use it in GitHub Desktop.
PHP: Wordpress functions.php add thumbnails to rss feed #rugor #st
// Use the thumbnails in the RSS feed
function diw_post_thumbnail_feeds($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<div>' . get_the_post_thumbnail($post->ID) . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'diw_post_thumbnail_feeds');
add_filter('the_content_feed', 'diw_post_thumbnail_feeds');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment