Maby this helps:
[ link deleted ]
it shows the post’s featured image in your rss feed.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Gerald? Can you please refrain from sending users to your site that way? It helps people more and as you’re probably aware sending users to your site can and has been abused.
You can easily share your code like so.
/**
* Snippet Name: show featured image in rss feed
*/
function wpc_featured_image_in_feed( $content ) {
global $post;
if( is_feed() ) {
if ( has_post_thumbnail( $post->ID ) ){
$output = get_the_post_thumbnail( $post->ID, 'medium' ) );
$content = $output . $content;
}
}
return $content;
}
add_filter( 'the_content_feed', 'wpc_featured_image_in_feed' );
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Also (and I’m replying again to generate that email) I am not attributing any bad motives and I do applaud you helping here! But please do keep it here when possible.
Hi Jan,
sure no problem. Sorry.
I just added exactly that function minutes before reading that post here.
And as you see my site’s concept is excactly the opposite of harming any WordPress user 🙂
But sure I understand your point.
Thanks, I tried it with this code (it’s in my childtheme) but now I only get codes when I go to my feed: http://www.somewheresomethingblog.com/feed/
What am I doing wrong?
sorry, there’s one bracket too much – replace the line with this:
$output = get_the_post_thumbnail( $post->ID, 'medium' );
I tried it again and it returns the proper img data which should look similar to this:
<content:encoded>
<![CDATA[
<img width="300" height="224" src="your-img-url" class="attachment-medium wp-post-image" alt="">
]]>
</content:encoded>
please try to update your latest post (which has a featured image) and refresh your feed url.