Logo In RSS Feed – In WordPress Blogs And Elsewhere

I have been having the need (or want, as you may see fit) to display a logo in my RSS feed – for my WordPress powered blog as well as home-cooked Showcase. Couple things one needs to keep in mind when designing such logos is the following (information summarized from here):

  1. Maximum value for width is 144, default value is 88
  2. Maximum value for height is 400, default value is 31

In the following two sub-sections, I will show what I did to accomplish this thing.

Case #1. A WordPress Blog

It’s fairly simple to achieve it in that the following lines need to be put into functions.php, found within the theme of your choice. WordPress-provided hook, add_action(‘rss2_head’, ‘function_name’), puts this information in an appropriate place within the RSS feed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
add_action('rss2_head', 'my_logo_rss');
 
# The value of  tag needs to point to the image. It DOES NOT have
# to be within the WordPress folder.
function my_logo_rss() {
  echo "\n";
  echo "\t\n";
  echo "\t" . get_journalinfo('siteurl)'. "/site_logo_rss.png\n";
# echo "\thttp://your-site.com/images/site_logo_rss.png\n";
  echo "\t" . get_journalinfo('url') . "\n";
  echo "\t32\n";
  echo "\t32\n";
  echo "\t\n";
}


Logo in RSS Feed

Logo In RSS Feed – A WordPress Blog

Case #2. A Non-WordPress Blog

It’s fairly simple to achieve it even here – as long as one has access to a program/PHP file that generates the RSS feed. Add the following lines to the program, just before the first <item> begins (with values appropriate to your site of course), and that’s about it.

1
2
3
4
5
6
7
echo "\t\n";
echo "\t\n";
echo "\thttp://sgowtham.com/images/site_logo_rss.png\n";
echo "\thttp://sgowtham.com/\n";
echo "\t32\n";
echo "\t32\n";
echo "\t\n";


Logo in RSS Feed

Logo In RSS Feed – A non-WordPress Blog

This Does NOT Seem To Be Working!

Believe it or not, it didn’t work for me either – not at least until I cleared out the browser cache and hit the refresh/reload button. I have heard that most RSS readers still don’t recognize this icon/logo thing yet but it doesn’t hurt to have it – when it does show up, it sure does feed our ego!

One Reply to “Logo In RSS Feed – In WordPress Blogs And Elsewhere”

  1. [… – sgowtham.com is other nice source of information. Online Car insurance claims [… –

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.