Adding the image tag to Wordpress's rss headers

Jul 28, 2008 21:42

The RSS specification allows you to have an 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(' ( Read more... )

programming, code, wordpress, geek

Leave a comment

Comments 17

Compatible? anonymous May 14 2009, 07:54:46 UTC
I use WP 2.7.1, and recently inserted the code into my functions.php, but no image show up in rss reader. No wonder: the lines defined in the function are simply not echoed in the source of my rss file, as if function did not executed at all at rss_head.
The same applies to 'blog icons' plugin, which I tried previously and works fine, except that image related lines in rss source are also absent. Curiously, plain favicon related code is echoed perfectly in index.php header.
I wonder, if rss_header hooks work in recent WP version just the same as used to?

Reply

Re: Compatible? dblume May 14 2009, 14:16:15 UTC
Yes, it works in WP 2.7.1, and even through redirects through feedburner! See my family blog for an example. View source to convince yourself of my WP version. (The feed actually redirects to http://feeds2.feedburner.com/dlma/my, which retained the image tag.)

Reply

Re: Compatible? anonymous May 14 2009, 21:13:12 UTC
Well, I'm perplexed. After my first comment, I removed the code from functions.php (didn't want to left behind code which didn't seem to work), but I left 'blog icons' plugin (which is basically just the same, with an admin interface) installed. I know it sounds silly, but since then, the image related code "appeared" in all 3 feeds over time, first in the Atom and rss feeds, then at last in the rss2 feed too. Now it's all fine. Maybe it was some kind of a caching issue, or something like that.

(By the way, do you know how to use feed favicons with rss? Atom can specify it, but rss doesn't. Somehow, most rss feeds I'm subscribed to show their favicons in the feed reader. Maybe the reader automatically pick up the site's regular favicon?)

greetz!
Charlie Brown

Reply


hjzpqduvobgw May 18 2009, 11:37:19 UTC
I really like how you did this but unfortunately I can’t get it to work on my site. I think my code is a bit different and I’m not sure which bits are affecting the outcome. I’ll keep trying because I really like the result.nancy

Reply


Good idea anonymous July 15 2009, 13:31:44 UTC
I did not know this! It's a good idea, Thanks for the code, I'll try it on my blog! voyance

Reply


Don't understand anonymous September 14 2009, 14:21:12 UTC
I don't want to sound like an idiot but this is all very new to me. All I want is to add an image to my header.

This is my page: http://lchoafwb.org/naranonfl/

I would love to have a background image with our logo but I definitely want one to the left of the wording Nar-Anon Florida Region. Just to the left of that would be perfect.

Can someone please help me? Thanks.

Reply

Re: Don't understand dblume September 14 2009, 15:48:04 UTC
The subject of this post has nothing to do with any of the images displayed at your website. It's only about putting an image in your blog's RSS feed's header, which is a detail that most people won't worry about.

When it comes to customizing your blog's "header" the way you want, that's customizing your blog's theme's header. You'll have to learn about customizing themes. You may find help with that over at Wordpress.org. Good luck!

Reply


Alt text anonymous December 15 2009, 13:38:08 UTC
Hello David,

Thank you very much for the article!

Do you happen to know how does one add the alternate text for the image included in the RSS feed?

Cheers,

Nik

Reply


Leave a comment

Up