Apparently WordPress doesn’t add featured images as proper enclosures to the RSS feeds, so I created a little plugin called Feed Image Enclosure that will do just that. You can download it from GitHub.
Apparently WordPress doesn’t add featured images as proper enclosures to the RSS feeds, so I created a little plugin called Feed Image Enclosure that will do just that. You can download it from GitHub.
I’ve written just the same plugin, but it looks like I haven’t updated it in over two years so it’s not showing up on the wp.org repo any more! http://wordpress.org/extend/plugins/feed-thumbnails/
Thanks for the tip, John. I actually did search the repo before and didn’t find anything, so I just created it. Your plugin is a good in being able to extract images from the content as a fallback.
Thanks a lot Kaspars! This is exactly what I need. Currently using it in my functions.php with some modifications.
Sounds good, Jacquesdancona! Is it possible to see your changes and modifications somewhere online? There might be people interested in it.
How come you put it in GitHub and not the WordPress plugin repository?
I wrote the plugin for my own needs so I chose GitHub because I don’t want to deal with writing docs, etc. In addition, GitHub provides an easy way for others to contribute to the code. You don’t even need a local Git client to submit things like docs.
Is your Plugin: Add Featured Images as Enclosures to Posts in WordPress RSS Feeds still current? I am using WordPress 4.2.2
Thanks
Yes, it works perfectly with the latest version of WordPress.
This has been a nice solution for an issue I was having with one RSS feed, so thank you. I’m wondering if the php could be easily modified to pull the first post’s image instead of featured image?
Using the featured image is simply the easiest solution since it relies only on WordPress core methods. Here are the two ways to extract the first image from an HTML blob (I suggest the
DOMDocument
approach).Hello Kaspars, I want to know if there is a way to use the full image size instead of the thumbnail.
Yes, there is the
rss_enclosure_image_size
filter which can be used to set the thumbnail size. For example, this snippet will set the image size to“large”“full”: