Last active
January 19, 2016 21:30
-
-
Save rugor/5417954 to your computer and use it in GitHub Desktop.
PHP: Wordpress functions.php add thumbnails to rss feed #rugor #st
This file contains 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
// 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