webadmin's picture

Drupal 7 override feed icon image

Coding

When we make new themes there is Feed Icon we want to customize, this icon image we want to customize is use our custom image from our custom themes,..
First you need is image rss.png custom file what do you want, and copy that file to /yourcustomtheme/images/rss.png as an example.
Then make code snippet on your template.tpl.php

Ok here we go ;

<?php
function minimax_feed_icon($variables) {
$text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title']));
if ($image = theme('image', array('path' => ''.path_to_theme().'/images/rss.png', 'width' => 24, 'height' => 24, 'alt' => $text))) {
return l($image, $variables['url'], array('html' => TRUE, 'attributes' => array('class' => array('feed-icon'), 'title' => $text)));
}
}
?>

That code snippet get from code D7 core http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_feed_icon/7, from there we can override that to template.tpl.php

Original Code D7 Theme Feed Icon :

<?php
function theme_feed_icon($variables) {
$text = t('Subscribe to @feed-title', array('@feed-title' => $variables['title']));
if ($image = theme('image', array('path' => '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)));
}
}
?>

Copy code snippet above in your custom themes file template.tpl.php
Example above if we have custom themes name "minimax".