Skip to content

Instantly share code, notes, and snippets.

@roscabgdn
Created July 3, 2017 10:20
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 roscabgdn/c30fc808d18d6eaec38417e51c6c85dc to your computer and use it in GitHub Desktop.
Save roscabgdn/c30fc808d18d6eaec38417e51c6c85dc to your computer and use it in GitHub Desktop.
Add post featured image as rss node
// Add the image node to RSS feed
add_action('rss2_item', 'add_featured_image_as_rss_node');
function add_featured_image_as_rss_node() {
global $post;
if(has_post_thumbnail($post->ID)):
$thumbnail = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
echo("<image>{$thumbnail}</image>");
endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment