Last active
October 23, 2017 04:25
-
-
Save braddalton/5648134 to your computer and use it in GitHub Desktop.
Featured Image To RSS Feed http://wpsites.net/web-design/add-featured-image-thumbnail-from-post-to-rss-feed/
This file contains 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
function wpsitesdotnet_post_thumbnail_rss($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '' . get_the_post_thumbnail( $post->ID, 'rss-image', array( 'style' => 'float:left; margin-right:10px; height: 150px; width: 300px; border: 2px solid #e5e5e5' ) ) . '' . $content; | |
} | |
return $content; | |
wp_reset_postdata(); | |
} | |
/** | |
* @author Brad Dalton | |
* @example http://wpsites.net/web-design/add-featured-image-thumbnail-from-post-to-rss-feed/ | |
*/ | |
add_filter('the_content_feed', 'wpsitesdotnet_post_thumbnail_rss'); | |
add_filter('the_excerpt_rss', 'wpsitesdotnet_post_thumbnail_rss'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment