Releasing… wpRichFeeds!

MailChimp LogoI’ll confess a couple little secrets: I LOVE MailChimp and I LOVE WordPress.

Both are amazing tools for today’s world, beautifully crafted from A to Z. I can’t help but love a product that whenever I look for something I found it precisely where it should be, and I mean inside and outside of the product itself: Support, Documentation, Services, you name it.

One of the favorites MailChimp’s feature for every blogger must be the RSS-To-Email. It allows them to create a marketing campaign using any RSS Feed. It does all the dirty job for you: Format it, populate it, send it, track it. It just take to word AUTOMAGICALLY to a whole new level.

However, one of the problems I’ve found while using this tool with the WordPress-generated feeds, is that there’s not a build-in way to include pictures in a WordPress RSS or ATOM entry’s namespace, you have to do it manually, somehow. And I’m sure I’m not the only one that had suffered this pain.

On the other hand, I recently had to make some changes to a client’s WordPress/MailChimp installation and I almost screw it up because I was about to forgot the hacks I made for that client’s RSS and ATOM feeds. It wouldn’t be funny.

So I finally decided to make those hacks up a lil bit and make them, officially, a Free WordPress Plugin so here I am introducing you to… drums please…

wpRichFeeds

wpRichFeedsWhat’s it? Well, as I said, it’s a Free WordPress plugin that does only two things:

  1. Allows you to include a image as the header of your RSS/ATOM feeds. Sounds simple, but it adds a lot to the feed in terms of search results’ look and brand exposure. It also allows you to add an icon for the ATOM feeds.
  2. Allows you include an image for every feed entry as an attachment or “enclosure” for the item.  This enclosure could be used for the feed reader and, basically, visually defines the feed entry. wpRichFeeds has three build-in methods to fetch the image that will be used for this: By default, it fetches the first image of the post content but you can specify if you rather prefer to use the WordPress Post Thumbnail feature (if your theme supports it) or to use a Custom Field.

However, it’s not surprise that this sort of things are not commonly solved out there. There are plenty of scenarios that needs to be addressed to make it works… out-of-the-box. And given that I do not pretend to invent anything super revolutionary, I don’t even tried to solve them.

I leave them to you… but I’ll give you a hand: The plugin calls three WordPress filters that you can use to try to solve some of your particular needs. They are:

  • wprichfeeds_image_path: It receives the image fetched from a post. If you are having trouble finding the size or format of this image, try to sanitize it and return the path to the image, instead of a its URL. This filter is called BEFORE the final image link is created.
  • wprichfeeds_image_url: It receives the image fetched from a post. If you are having trouble finding the size or format of this image or even the image itself, try to sanitize it and return a URL relative to the web root. This filter is called BEFORE the final image link is created.
  • wprichfeeds_image_filter: It receives an array which the elements of the final image, which are url, size and type. You can make any last minute change to the way the plugin creates the link to the image inside the feed.

These filters are suppousely to be used inside the functions.php of your theme or inside another plugin.

Here’s an example of its usage:

function my_path_filter($path) {
	if (substr($path,0,7) == 'http://') {
		$path = str_replace('http://','',$path);
	}
	if ( strpos($path,'/') !== false ) {
		$path = substr($path,strpos($path,'/')+1);
	} elseif ( strpos($path,'?') !== false ) {
		$path = 'index.php'.substr($path,strpos($path,'?'));
	}

	return '/home/public_html/'.$path;
}

function my_url_filter($url) {
	return 'http://www.williamscastillo.com/timthumb.php?src='.$url.'&h=180&w=250&zc=1';
}

function my_image_filter($image_array) {
	return $image_array;
}

add_filter('wprichfeeds_image'		,'my_image_filter');
add_filter('wprichfeeds_image_path'	,'my_path_filter');
add_filter('wprichfeeds_image_url'	,'my_url_filter');

 

Well… That’s all for now. Any kind of comments or suggestions are welcome (well… not all, do not spam it, please).

For some reason, wpRichFeeds has been pulled off from the Official WordPress Repository. I can’t see a reason but I don’t have the time to investigate it right now so in the mean time, you can download it from here.

Download wpRichFeeds



31 Responses to “ “Releasing… wpRichFeeds!”

  1. John Salomon says:

    Hi Will,

    I am trying out your plugin, without any luck unfortunately.

    Is it possible to display a remote thumbnail as part of a RSS feed? So if my post is http://www.zog.net/blah, and the thumbnail is http://www.foo.com/bar.jpg, should it show up? As you can see on my site, post thumbnails are enabled via the theme (it does not use TimThumb, but wordpress native thumbnails) but I take the thumbnails from another site of mine — I host all my images on smugmug.com due to bandwidth limits on my site.

    I am using ‘post thumbnail’ as fetching method, and have not made any changes to functions.php.

    Thanks!

    -John

    • Will says:

      Hello Jhon,

      Currently, there’s no fully support for remote thumbnails, sorry. There are limitations that I’m trying to bypass. I’d recommend you to use the media:content publishing method and see if it make the plugin works as expected within your web hosting.

      Right now, the problem is that I have to find a reliable and efficient way to get the size and mime type of a remote image. The mime-thing is already done, but I’m still stuck with the size.

      I’ve been monitoring your feed and caugh you playing :) As you can see, you can use remote images… but the plugin can’t calculate its size hence returning a blank field in your feed.

      Still working on it, though. Any suggestion is most welcome!

      All best,
      Will

    • Will says:

      Hi John,

      I’ve uploaded a fixed (v1.04) that get ride of the PHP error inserted in the feed.

      It still does not include the file size for remote thumbnails though.

      All best,
      Will

  2. [...] usually) is correctly bringing in the first image. I used a plugin called wpRichFeeds (view plugin author site) which ads the enclosure information to your feed in WordPress. This is basically [...]

  3. Rob says:

    Hey Will,

    Firstly I’d like to say this plugin sounds amazing and just what I’m looking for however I can’t seem to get it working.
    I have downloaded the plugin, installing in plugins folder and set it to use a custom field, set the custom field name and the fetch type but cant get it to show images on my feed http://mysite.com/feed/rss/ It still just lists the titles etc. I have tried clear the cache.

    What I’m trying to do is set up a campaign in mailchimp which uses my blogs rss feed for content including images.

    would be great to get it going using this plugin. any ideas?

    thanks mate

  4. Lorna says:

    Hi,

    Thanks for this great plugin. It took me some time to figure it out but now it is working (well almost). I am wordpress user and some of my posts feature just an image – no words. With those posts, I am getting two images in my mailchimp layout. What should I do to have it so that when the post is only an image it doesn’t post the actually image from the story and the one that is being pulled using wprichfeeds? Any help will be appreciated.

    • Will says:

      Hi Lorna,

      I’d like to know what you find difficult in this plugin. It could help me improve it!

      I’m not sure MailChimp provides the kind of customization you need here: Something like *|IF:RSSITEM:ENCLOSURE_URL|* It’s a good question/suggestion for the MailChimp Jungle or something that you can have fun testing yourself.

      Anyhow, perhaps the best option for you is to create the logic in your end (WordPress’ end). wpRichFeeds has some filters that you can use to DO NOT include the feed’s image if the post is just an image, for instance.

      I hope it helps!
      Will

  5. Lorna says:

    Hi Will,

    For some reason when I installed the plugin, the feeds just disappeared. So, when I went to mysite.com/feed it was blank. I couldn’t figure out why. It turns out that I had to create a post for the feed with images to appear and after it was truly a piece of cake.

    Ok.. so are the filters that I need to use if the post is only an image?

    • Will says:

      Hey,

      The wprichfeeds_image filter seems to be the one you need.

      I haven’t test it but I think something like…

      function my_image_filter($image_array) {
      global $post;

      // here, check the content of the post,
      // or probably a custom field to be sure…
      // If you determine that the post does not
      // need an image in its item feed, then return
      // an empty array.

      if ( content_is_image_only($post) ) return array();

      return $image_array;
      }
      add_filter(‘wprichfeeds_image’ ,’my_image_filter’);

      I hope it helps! Let me know if it works for you.

      All best,
      Will

  6. Manuel says:

    I hope I get this plugin to work, that would be so awesome! Thank you for making it.

    My problem is this:
    I’m using the fetching method “Thumbnail” and the publishing method “Enclosure”. It fetches the images but for some reason puts a “%20″ into the image filename, like this:

    image.png%20

    So instead of an image, the RSS entry has a weird file attached that can’t be opened.

    I tried playing with the filters and changed the my_url_filter:

    function my_url_filter($url) {
    return ‘http://www.myurl.net/’.urlencode($url);
    }

    But it doesn’t solve the problem.

    Any thoughts on this?

  7. Chris says:

    Hi! Mailchimp RSS-to-Email was working, but then I changed themes and now it isn’t working. So I tried your plug-in. It looks like it should be working. The feed is:

    http://uventure.net/blog/feed

    As an example, it shows:

    TEDxCalgary – Threads of Ideas

    But it doesn’t show up in MailChimp. Could it have something to do with the tag?

    On the MailChimp side I have simply:

    *|RSSITEMS:|*
    *|RSSITEM:TITLE|*
    *|RSSITEM:DATE|* | *|RSSITEM:AUTHOR|*
    *|RSSITEM:IMAGE|*
    *|RSSITEM:CONTENT|*

    read more | comment

    *|END:RSSITEMS|*

    Any ideas?

    Thanks!
    Chris

  8. Loren says:

    Will

    Thanks for your plugin. I appear to have installed it properly. I made the following selection in the settings:
    - RSS/ATOM Logo URL: I selected my image and this displays underneath where I typed the URL, so it appears this is correct. (I don’t think I will use this function though).
    - Fetching method: Post Thumbnail
    - RSS Publishing Method: enclosure (1 per feed entry)

    Everything else I have left blank as I don’t think I need that information. I haven’t adjusted or done anything else with the wpRichFeeds Filters Example code. It wasn’t clear what I was meant to do with this from the instructions.

    I am using mailchimp and would like for you to spell out exactly what RSS merge tag I should be using. All I want to do is get the thumbnails from each post to be included as part of my enews alongside each post in my RSS email. The default for the theme I am using is as follows and would appreciate some advice on what modifications I need to make to enable the thumbnail images to show up:

    *|RSSITEM:TITLE|*
    *|RSSITEM:DATE|* | *|RSSITEM:AUTHOR|*
    *|RSSITEM:IMAGE|*
    *|RSSITEM:CONTENT_FULL|*

    Thanks!

    Loren

    • Will says:

      Hi,

      Either:
      *|RSSITEM:TITLE|*
      *|RSSITEM:DATE|* | *|RSSITEM:AUTHOR|*
      <img src=”*|RSSITEM:IMAGE|*”>
      *|RSSITEM:CONTENT_FULL|*

      Or:
      *|RSSITEM:TITLE|*
      *|RSSITEM:DATE|* | *|RSSITEM:AUTHOR|*
      <img src=”*|RSSITEM:ENCLOSURE_URL|*”>
      *|RSSITEM:CONTENT_FULL|*

      I hope it helps,

  9. Josh says:

    Hey Will. Thank you for the plugin. I’ve got it working with Mailchimp. There is only one issue. When I look at my feedburner feed, I now see the following text at the end of each post “MEDIA ENCLOSURE:” You can see this happening here: http://feeds.feedburner.com/missionrecife. Is there a way to remove this from appearing on feedburner? Thanks

    • Will says:

      Hey Josh,

      I guess you will need to use the other publishing method. I’m not familiar with FeedBurner though.

      All the best,
      Will

  10. Hi Will,

    I found your plugin in a post the mailchimp marketing blog. Thank you for building it!

    I have a site using the webcomic plugin. I want to provide email subscription via mailchimp, but can’t get the images to show up in the email, or in the popup preview window when building the feed in mailchimp.

    I’ve been told by mailchimp to create a mailchimp-specific feed and tag all images with media:content.

    I tried your plugin, hoping for the same effect, but no dice.

    All I get is a blank thumbnail with a broken image link icon in the middle. Clicking that takes you to the comic, however.

    I consider this a step in the right direction, but still not there, yet.

    Any suggestions?

  11. Of course! Thank you.

    It’s not out there in the world yet. Test images only. But it is live:

    http://feeds.feedburner.com/EverForward

  12. P.s. Currently I have email subscription set up with feedburner and the images do not show up in those emails either.

  13. Thanks Will. I’m pretty new at this. Can you tell me where to find that?

  14. mark says:

    Where can we download this plugin?

  15. Loren says:

    Sorry to be a pain with all the questions, but I am using mailchimp RSS and it is pulling in all the images brilliantly. However, for some posts I don’t have an image so I was wondering if there was a way to tell it not to include anything if there is no image rather than the blue question mark image that it is displaying for the error when it can’t find an image?

    This is what I have in the source at present (messy formatting I know because I have made a lot of changes in the format and I am too scared to change anything incase I stuff it up):

    *|RSSITEMS:|**|RSSITEM:TITLE|*

    *|RSSITEM:CONTENT|* Read more…
    *|RSSITEM:TWITTER|* *|RSSITEM:LIKE|*

    *|END:RSSITEMS|*

    • Loren says:

      For some reason it didn’t copy in the format as per the source code. Trying again (putting it in quotation marks to see if that allows it to be posted in this format):

      “*|RSSITEM:DATE|* *|RSSITEM:AUTHOR|*

      *|RSSITEM:CONTENT_FULL|*”

      • Will says:

        No problem. I think I know what you are talking about.

        A template is a template so once you use it, its code is written in stone and can’t be changed.

        That means that if you code it to expect an image, it will expect it no matter what. You are responsible to sent it a picture for every entry in the feed.

        I understand that that’s not the case for every single blog post so my advice would be to use the filter the plugin provides and, when the post doesn’t have an image, send either a default image with your logo or something… or send a transparent gif.

        That should solve your problem.

        W

Leave a Reply