Last active
November 19, 2018 18:18
-
-
Save dannydover/76e8bd1c31ca011de2bcdb412a555ce7 to your computer and use it in GitHub Desktop.
Show Featured Image in Wordpress RSS Feed - Credit: https://woorkup.com/show-featured-image-wordpress-rss-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 | |
| /* Add Featured Image to beginning of RSS Feed entries */ | |
| function featuredtoRSS($content) { | |
| global $post; | |
| if ( has_post_thumbnail( $post->ID ) ){ | |
| $content = '<div>' . get_the_post_thumbnail( $post->ID, 'large', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content; | |
| } | |
| return $content; | |
| } | |
| add_filter('the_excerpt_rss', 'featuredtoRSS'); | |
| add_filter('the_content_feed', 'featuredtoRSS'); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment