Log in

No account? Create an account

July 28th, 2008

The RSS specification allows you to have an <image> element in the header of your RSS feed.  A long time ago, if you used Wordpress, you'd have to edit the wp-rss.php file and be very careful when you upgraded to new releases, or your change could be lost.

But if you use a modern version of Wordpress, you should take advantage of the do_action('commentsrss2_head') hooks* in the feed-rss... .php files.

Here's what you'd do: Add the following code to your theme's functions.php file:

function add_my_rss_image()
echo '<image><title>', bloginfo_rss('name'), '</title>';
echo '<url>', bloginfo_rss('stylesheet_directory'), '/images/button.gif</url>';
echo '<link>', bloginfo_rss('url'), '</link>';
echo '<width>88</width><height>31</height>';
echo '<description>Description of your blog.</description></image>';


Take care to actually put an image file in the path specified, and adjust the width and height accordingly.

Et, voila! Now your feeds have images, and they're forwards compatible with future versions of Wordpress. Oh, did I say future versions of Wordpress? Excuse me, I have to:

svn sw http://svn.automattic.com/wordpress/tags/2.6/

Blam! Upgraded. Sweet.

* Also rss2_head and rss_head, just so I cover the appropriate Google terms.



  • 5 Mar 2019, 22:27
    Welcome back to LJ.
    Even if it's just one post :-P

    People moved all over the internet.
    I stil like Plurk the best.
  • 4 Mar 2019, 06:13
    Good to see you checking in at LJ again, too. No, I'm not online anywhere like we used to be at LJ and Plurk. I really liked having a place where we could share our thoughts in a long-form post that…
  • 4 Mar 2019, 03:33
    Good to "see" you checking in at LJ... and taking steps to preserve your LJ and Google+ histories!

    Even better to see "you" and not your Dead Man Switch kicking in... again.

    Do you have a primary…
  • 13 Jan 2018, 18:54
    I "Searched" some of your archive looking for the fluorescent bulb post, but couldn't find it through 2009-02-06, and before that, LiveJournal no longer offers pages of your feed, just daily access,…
  • 10 Jan 2018, 18:22
    Ha ha! How coincidental, I was thinking about light bulbs yesterday myself. One of my Instagram contacts mentioned that the EU regulates the types of light bulbs people can use in their homes in…
Powered by LiveJournal.com
Designed by Jared MacPherson