fourwhitesocks

Add featured image to RSS feed

Jul 1st, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <?php
  2. add_filter( 'the_content', 'featured_image_in_feed' );
  3. function featured_image_in_feed( $content ) {
  4.     global $post;
  5.     if( is_feed() ) {
  6.         if ( has_post_thumbnail( $post->ID ) ){
  7.             $output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) );
  8.             $content = $output . $content;
  9.         }
  10.     }
  11.     return $content;
  12. }
  13. ?>
  14.  
  15. credit to:  https://wpism.com/image-wordpress-rss-feed/
Advertisement
Add Comment
Please, Sign In to add comment