Aligning Images In RSS Feeds

When inserting an image into a post, WordPress lets you choose an alignment (left/right/center/none) and even add a caption. This usually works well when viewing the post on the blog itself, but will often look messed-up in the RSS feed. Basically, the image becomes unaligned and breaks the intended post layout. I’ve found an easy way to fix it.

As it turns out, the problem appeared when WP developers chose to remove the deprecated “align” attribute from the WordPress-generated <img> tags. Now, following web standards is all well and good, but what if you still want to align an image in a way that works in the feed, too? The typical answer is to add a style="float:left;" (or “float:right;”) attribute to each aligned image. However, that would become very bothersome if you had to manually edit the HTML code every time.

So I created a plugin that will do it automatically.

Plugin Description

“Align RSS Images” is a simple plugin that scans your RSS feed and ensures that every image has the correct alignment and margin settings. Technically speaking, it finds HTML elements styled with any of the WordPress-generated classes and appends an appropriate style attribute to each element. This is done dynamically when the feed is generated, so your actual posts won’t be modified.

Left-aligned picture in a RSS feed

Sidenote : Yes, I know that using styles in a RSS feed isn’t exactly standards-compliant either. Nevertheless, it works fine with Google Reader and the W3C Feed Validator says the feed is OK. So most likely the sky won’t fall on your head if you use this plugin 😉

Download

align-rss-images.zip (2 KB)

Requirements : WordPress 2.6 or later
Installation : Just upload and activate. The plugin is completely automated, but due to caching you may need to wait a few hours for the changes to appear in your RSS reader.

Related posts :

102 Responses to “Aligning Images In RSS Feeds”

  1. […] Align RSS Images WordPress Plugin can easily fix your Feed Images alignment issue without need of modifying your post. […]

  2. […] solution can work and, if you choose the first or second route, there is a great WordPress plugin to help make it easier, but for most is it is easiest to just put the images in their own paragraph and move […]

  3. […] solution can work and, if you choose the first or second route, there is a great WordPress plugin to help make it easier, but for most is it is easiest to just put the images in their own paragraph and move […]

  4. derek says:

    how about automatically changing all those styles to classes? The problem that I enconter is after changing my theme, it did not recognize the align=right or left attribute.
    So I am thinking on how can I use this plugin that way.

  5. White Shadow says:

    If I understand correctly, you could manually add the classes to your theme. Classes don’t work that well in RSS feeds though (AFAIK), so that’s why I use explicit styles there.

  6. […] Align RSS Images by Janis Elsts While you can align images left/center/right when inserting them into a post, they […]

  7. […] Align RSS Images 1.1 – Por Janis Elsts – Fuerza a que las imágenes en el feed se queden alineadas como en el blog. […]

  8. […] Align RSS Images Δυστυχώς το rss feed που παράγει το wordpress είναι λίγο προβληματικό στο θέμα του σωστού alignment των φωτογραφιών, με αποτέλεσμα ένα άρθρο που έχει π.χ. 3 φωτογραφίες και το έχετε κάνει έτσι ώστε οι φωτογραφίες να εμφανίζονται ωραία δίπλα στο κείμενο, όταν δείτε το feed, οι φωτογραφίες έχουν χάσει το alignment και διακόπτουν το κείμενο. […]

  9. Elwen says:

    I have just tried de plugin and had to remove it because it was not compatible with my google friend connect widget. Somehow de followers disapear from the box, I know is weird but it happens. Just wanted to let you know ^_^

  10. White Shadow says:

    Weird indeed, and might be good to know. I have no idea why it happens, though.

  11. Pyrameda says:

    Very cool plugin. Thank you very much!

  12. […] Align RSS Images Wenn man Bilder mit float:left und float:right in Texte einbindet, sieht das zwar im Blog selbst gut aus, im RSS Feed funktioniert das jedoch nicht. Mit diesem kleinen Wunderwerk sieht auch der RSS Feed aufgeräumt aus. http://w-shadow.com/blog/2008/12/31/aligning-images-in-rss-feeds/ […]

  13. […] and they align nicely, things won’t look as pretty when you get the post in a feed reader. This plugin aligns images in your RSS feed so they are exactly where they would be on your site.8. Backtype […]

  14. D. Lambert says:

    Hi – I just found this (linked from http://www.viperchill.com/launching-new-blog/). Not only have I seen this problem in my feed, but I also just finished writing a plugin that does something like this for a user-generated text box, or callout (http://wordpress.org/extend/plugins/insert-callout/).

    I really like the way you’re doing the find-and-replace in the plugin. I’m going to play with doing something like that in mine, too.

    I’ve installed this plugin, and I’ll do some testing, but I’m not positive this will work 100% because I sometimes use Zemanta to insert images, and that uses different classes for images. Should be a pretty easy fix, though.

  15. Booga says:

    Still not working… WP 2.8.6, Gabfire WPNewspaper Theme, http://www.cronicamarinaalta.com, installed the plugin but images on RSS are not aligned, what should i try?

    Nice plugin, good work!

  16. […] więc aby dobrze wyświetlać obrazki w RSS możesz śmiało pobrać wtyczkę ze strony autora. Podziel się z […]

  17. Great! I’ve been looking for something like this to fix the images in my RSS feed. Thanks for the plugin!

  18. […] Align Images in RSS Feeds – does what it says on the box.  WordPress uses styles to align images, but those styles don’t work in RSS feeds.  All images end up as non-aligned in the feed.  Eric Gray of VCritical (Blog – Twitter) turned me on to this simple plugin that fixes ‘em. […]

  19. […] ۱-Align Rss Image: خیلی افزونه‌ی کاربدی‌ای است، باعث می‌شود که چپ‌چین و یا زاست چین بودن مطالبتان در در فیدخوان‌ها حفظ شود. خیلی هم کم حجم است! […]

Leave a Reply