When we run the https://www.mysite.com/feed/ FEED URL – we dont seem to see the image tag.
I am looking for the image link in the feed… or an image url.
Can you advise?
-
This topic was modified 8 years by
Alin [tagDiv].
-
This topic was modified 8 years by
Alin [tagDiv].
Known issue with WordPress; you can add a function to include featured image as an enclosure; and you can also make a custom RSS feed and setup however you wish. Problem with using a featured image template where image lives “outside the post meta box” is that it will then, of course, not be included inside the post meta in RSS.
What we do on our sites is create custom RSS feed template which adds the “large thumb” at top of the cdata for the post info, and function to make it an enclosure.
Simplest thing is to actually use featured image in the post meta vs featured image outside of post box; but not as sexy on website.
Or, you need to make a custom RSS feed template per the basic docs here:
https://codex.wordpress.org/Customizing_Feeds
http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-rss-feeds-in-wordpress/
Hope that helped. I don’t work here, just long time WP user and TagDiv customer 🙂
example function to add featured image
//Function to add featured image in RSS feeds
function featured_image_in_rss($content)
{
// Global $post variable
global $post;
// Check if the post has a featured image
if (has_post_thumbnail($post->ID))
{
$content = get_the_post_thumbnail($post->ID, 'full', array('style' => 'margin-bottom:10px;')) . $content;
}
return $content;
}
//Add the filter for RSS feeds Excerpt
add_filter('the_excerpt_rss', 'featured_image_in_rss');
//Add the filter for RSS feed content
add_filter('the_content_feed', 'featured_image_in_rss');
Hi
how can I use a smaller immage size for the RSS-Feed?
Cheers
Hansjörg
Hi Chris,
Does the example function code work for both desktop and mobile RSS feeds? or do we need to add something for mobile?
Thanks for your help.