Last active
July 22, 2016 18:03
-
-
Save justinstern/0d9bc89c5c9c52799b2c to your computer and use it in GitHub Desktop.
Include featured images in WordPress RSS feed post entries
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 everything below this point to the bottom of your current theme's functions.php | |
function prepend_thumbnail_rss( $content ) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ) { | |
$content = get_the_post_thumbnail( $post->ID, 'full' ) . $content; | |
} | |
return $content; | |
} | |
add_filter( 'the_excerpt_rss', 'prepend_thumbnail_rss' ); | |
add_filter( 'the_content_feed', 'prepend_thumbnail_rss' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment