Skip to content

Instantly share code, notes, and snippets.

@thagxt
Created October 15, 2015 21:02
Show Gist options
  • Save thagxt/a6058b00881ecad3d745 to your computer and use it in GitHub Desktop.
Save thagxt/a6058b00881ecad3d745 to your computer and use it in GitHub Desktop.
Display WordPress' featured image in RSS feed
<?php
function FeatToRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '' . get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'max-width: 300px;' ) ) . '' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'FeatToRSS');
add_filter('the_content_feed', 'FeatToRSS');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment