Created
December 10, 2016 09:30
-
-
Save santosh/3acc95d3ce0c19ef29a3bb2b000611b3 to your computer and use it in GitHub Desktop.
Add these line of codes to functions.php of your theme; to display thumbnail of featured image of the post. #WordPress
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
/*=================== | |
ADD IMAGE TO FEED | |
===================*/ | |
// display featured post thumbnails in RSS feeds | |
function WPGood_rss_thumbs( $content ) { | |
global $post; | |
if( has_post_thumbnail( $post->ID ) ) { | |
$content = '<figure>' . get_the_post_thumbnail( $post->ID, 'large' ) . '</figure>' . $content; | |
} | |
return $content; | |
} | |
add_filter( 'the_excerpt_rss', 'WPGood_rss_thumbs' ); | |
add_filter( 'the_content_feed', 'WPGood_rss_thumbs' ); | |
/*=================== | |
ADD IMAGE TO FEED ENDS | |
===================*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment