Last active
June 7, 2021 12:18
-
-
Save wbcomdev/05300cccaa76b6e7ed15b79a315b4dc8 to your computer and use it in GitHub Desktop.
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 | |
| /** | |
| * Show post thumbnails in rss feed. | |
| * | |
| * @param mixed $content | |
| * @return void | |
| */ | |
| function wbcom_add_thumbnail_in_rss_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; | |
| } | |
| add_filter( 'the_content', 'wbcom_add_thumbnail_in_rss_feed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment