Created
June 13, 2021 10:58
-
-
Save tdmrhn/6a77ebc342346790e0590ddf03adb6ac to your computer and use it in GitHub Desktop.
RSS Force Featured Image
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
add_filter('the_content', 'rss_force_featured_image'); | |
function rss_force_featured_image( $content ) { | |
global $post; | |
if( is_feed() ) { | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$prepend = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 10px;' ) ) . '</div>'; | |
$content = $prepend . $content; | |
} | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment