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.












On November 30th, 2007 at 4:34 pm Pre-Overhaul Maintenance - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure said :
On December 2nd, 2007 at 11:50 pm Feed Image Wordpress Plugin - Blog Archive - Ninedays Blog - web development, photography, tutorials and adventure said :
On December 10th, 2007 at 3:42 am meri said :
On December 23rd, 2007 at 8:51 am yamomoto said :
On January 29th, 2008 at 5:44 pm Hosting Bookmarks said :
On February 10th, 2008 at 6:28 am Michelle Wong said :
On February 14th, 2008 at 4:42 pm logo guru said :
On May 17th, 2008 at 8:42 pm [scribkin] Scribkin’s WordPress Plugins - Let Me Show You Them said :