Created
May 14, 2018 17:19
-
-
Save mateusneves/b10fbb54081189e697701f418fb814f2 to your computer and use it in GitHub Desktop.
Add featured image to WordPress 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
<?php | |
function featured_image_rss($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'style' => 'float:left; margin:0 15px 15px 0;' ) ) . '' . $content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'featured_image_rss'); | |
add_filter('the_content_feed', 'featured_image_rss'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment