function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');
WordPress RSS Feed With Featured Image
[updated_on]
[updated_on]
Share this post:
Share this post:
Featured
Top Guides
- Yoast SEO On-Page SEO
- MailChimp Setup & WordPress Integration
- How To Hide WordPress "Footprint"
- Keyword Research for 2018 & Beyond
1 thought on “WordPress RSS Feed With Featured Image”
Hi Bjorn,
I used this function with a live site and give me an error. “!PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘create_posttype’ not found or invalid function name in /var/www/vhosts/*****/httpdocs/wp-includes/class-wp-hook.php on line 286!”
I deleted “add_action( ‘init’, ‘create_posttype’ );” and works well and don’t give any error.
It’s necessary to put this action? It’s possible it could be add_action( ‘init’, ‘create_post_type’ );” ?
Thanks!