Change RSS Feed Icon with Drupal 7

t

Blog categories: 

After reading this article, I decided to change my RSS feed icon as well. However, the article does not cover Drupal 7 and so I explain the necessary steps here.

First, you should create your template.php, if zen has not created it for you, yet. Then, you need to decide, where to put the feed icon and how to name it. I simply use the same as Drupal: The image is feed.png and stored within the misc folder within my theme folder.

I followed the hint given in the original post and checked the Drupal API for the original function name (theme_feed_icon) and implementation. I just changed the image path from the original implementation (misc/feed.png) to drupal_get_path('theme', 'nesono') . '/misc/feed.png'.

Note that if you want to use this for yourself, you need to change nesono in the function’s name to your theme’s name!

function nesono_feed_icon($variables) {
  $text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title']));
  if ($image = theme('image', array('path' => drupal_get_path('theme', 'nesono') . '/misc/feed.png', 'width' => 16, 'height' => 16, 'alt' => $text))) {
    return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text)));
  }
}

That’s it again
Cheers,
iss

nesono