Created
January 25, 2016 09:49
-
-
Save Drivingralle/2e5be1e749f1442dfa21 to your computer and use it in GitHub Desktop.
Add featured image to 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 featured image to feed | |
*/ | |
add_filter( 'the_excerpt_rss', 'featuredToRSS' ); | |
add_filter( 'the_content_feed', 'featuredToRSS' ); | |
function featuredToRSS( $content ) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ) { | |
$content = '<p>' . get_the_post_thumbnail( $post->ID, 'large-image', array( 'style' => 'margin:0; border: 10px solid #202020' ) ) . '</p>' . $content; | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment