Adding a logo to your WordPress RSS Feed

Posted on: Tuesday, August 7th, 2007 at 10:37 pm

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.

Share this

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Furl
  • Ma.gnolia
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
  • Facebook

About this post

Post Navigation

10 Responses to “Adding a logo to your WordPress RSS Feed”

  1. On November 30th, 2007 at 4:34 pm Pre-Overhaul Maintenance - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure said :

    [...] this is still a work in progress since I am creating a plugin to do so inspired by Anup Shah Adding a logo to your WordPress RSS Feed tutorial. More about that plugin when it’s complete and I feature it on the blog! [...]

  2. On December 2nd, 2007 at 11:50 pm Feed Image Wordpress Plugin - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure said :

    [...] reading the article Adding a logo to your WordPress RSS Feed on onenaught.com I decided it was times to write another plugin. the solution of adding a function [...]

  3. On December 10th, 2007 at 3:42 am meri said :

    Great tutorial.

  4. On December 23rd, 2007 at 8:51 am yamomoto said :

    Thank you sooooo much!

  5. On January 29th, 2008 at 5:44 pm Hosting Bookmarks said :

    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.

  6. On February 10th, 2008 at 6:28 am Michelle Wong said :

    Thanks for the great information. I just suscribed to your blog feed.Michelle, HostGator Coupons

  7. On February 14th, 2008 at 4:42 pm logo guru said :

    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.

  8. On May 17th, 2008 at 8:42 pm [scribkin] Scribkin’s WordPress Plugins - Let Me Show You Them said :

    [...] to add a main image to your RSS or Atom feeds. Inspired by Anup Shah. By Terri Ann [...]

  9. On May 8th, 2009 at 4:50 pm Scot Lee said :

    Nice tutorial. Thanks for sharing.. please post some more.

  10. On November 17th, 2009 at 2:18 am Nora .F said :

    Was the only tutorial i found but is very good. If possible i would like to know how to replace the title and description of the feed with the logo. Thanks

Post a Comment