Last active
August 29, 2015 14:20
-
-
Save davidvandenbor/646e01eed5734e0f284a to your computer and use it in GitHub Desktop.
Add featured image to 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 | |
| // paste this in functions.php file | |
| add_filter( 'the_content', 'featured_image_in_feed' ); | |
| function featured_image_in_feed( $content ) { | |
| global $post; | |
| if( is_feed() ) { | |
| if ( has_post_thumbnail( $post->ID ) ){ | |
| $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) ); | |
| $content = $output . $content; | |
| } | |
| } | |
| return $content; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment