Skip to content

Instantly share code, notes, and snippets.

@gmmedia
Last active March 11, 2023 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gmmedia/bef974c87dffca5769886ef662efe7e1 to your computer and use it in GitHub Desktop.
Save gmmedia/bef974c87dffca5769886ef662efe7e1 to your computer and use it in GitHub Desktop.
<?php
// Add featured image to RSS feed
function j0e_imagetoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '
' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:left; margin:0 10px 10px 0;' ) ) . '
' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'j0e_imagetoRSS');
add_filter('the_content_feed', 'j0e_imagetoRSS');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment