Created
April 23, 2015 08:39
-
-
Save kosmiq/ab7d942987b929703e48 to your computer and use it in GitHub Desktop.
WordPress featured image in 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 to functions.php or wherever you extend your functionality. | |
function featuredtoRSS($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => '' ) ) . '</div>' . $content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'featuredtoRSS'); | |
add_filter('the_content_feed', 'featuredtoRSS'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment