Adding a logo to your WordPress RSS Feed

Update December 8, 2007: It looks like this article inspired Terri Ann Swallow at NineDaysBlog to create a WordPress plugin to do what this article describes, for you.

Update December 13, 2007: I gave the above WordPress plugin a go. Very nice. Try it out!

So, I am still feeling my way around the Word Press templating system.

One thing I found with the default RSS feed template is that it did not provide the ability to set an image for the feed. Not all feed readers support it but some, such as bloglines, do so it can be useful to maintain a personal brand.

Most support articles I found said you can just edit the wp-includes/feed-rss2.php template.

I didn’t want to do that because I think the updates that the hosting company can apply will override such changes. I would prefer to keep my changes localized to my theme area, so it is easy to simply put my entire theme back in if a major update is performed which would otherwise trash any core custom changes.

So I just started looking at some of the template and Word Press code, and figured I can put something like this into my theme directory’s functions.php:

add_action('rss2_head', 'onenaught_addRssImage');

function onenaught_addRssImage() {
  echo "<image>
    <title>One Naught</title>
    <url>" . get_bloginfo('template_directory') . "/images/onenaught.png</url>
    <link>" . get_bloginfo('url') ."</link>
    <width>116</width>
    <height>130</height>
    <description>OneNaught.com</description>
    </image>";
}

(I prefer to prefix my functions with the theme name, in this case, onenaught_. You can call yours whatever you want.)

You would then just need to edit the various RSS element values (e.g. your image location, dimensions, etc).

You could do something similar for the Atom feed too if you want. The action you hook into is called ‘atom_head’, so you would have

add_action('atom_head', 'onenaught_addAtomImage');

function onenaught_addAtomImage() {
  echo "<icon>http://example.org/favicon.ico</icon>
    <logo>http://example.org/logo.png</logo>"
}

I have not tested the Atom version, but the RSS one seems to work!

Hope that helps someone out there!

For some additional details, here is a useful link from Jonathan Snook: Add a logo to your feed.

Be Sociable, Share!

    10 thoughts on “Adding a logo to your WordPress RSS Feed

    1. Pingback: Pre-Overhaul Maintenance - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure

    2. Pingback: Feed Image Wordpress Plugin - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure

    3. Hi,

      This is really useful post so I’d refer it to some people trough social networks. I hope you don’t mind me to add it to HostingBookmarks.com as well. It is in category “Web Hosting Help” / Tutorials.

      PS: Are you willing to add some wordpress tutorials to other blogs?

      Cheers
      D.

    4. Thank you for this helpful information, I have always wanted to know how to add a logo to my RSS feed. You rock, nice bage’ and white blog I love it, going to look around more now.

    5. Pingback: [scribkin] Scribkin’s WordPress Plugins - Let Me Show You Them

    6. Pingback: rss logo - LOGO WORLD 2011 – LOGO WORLD 2011

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>