Skip to content

Instantly share code, notes, and snippets.

@ABooooo
Created February 8, 2020 20:32
Show Gist options
  • Save ABooooo/f5a18058ab9b30e63ff4e8b373638d99 to your computer and use it in GitHub Desktop.
Save ABooooo/f5a18058ab9b30e63ff4e8b373638d99 to your computer and use it in GitHub Desktop.
// add featured image to rss feed
add_filter( 'the_content', 'ld_featured_image_in_feed' );
function ld_featured_image_in_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$feat_image_output = get_the_post_thumbnail( $post->ID, 'full', array( 'style' => 'height: auto;margin-bottom:2em;max-width: 600px !important;padding-top: 0.75em;width: 100% !important;' ) );
$content = $feat_image_output . $content;
}
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment