Skip to Content

Replace the White on Red XML (RSS) Icon With a Custom Image

Categories:

With some knowledge of PHP and a PHPTemplate-compatible theme—all Bryght themes are PHPTemplate-compatible—you can replace the XML feed icon with one you've made yourself (and not just on the sidebar block but when it appears at the bottom of a page as well) by following the instructions below. It is based on the instructions on how to override a theme function at Drupal.org.

  1. Either create a new theme or modify an existing theme. You can do this using the in-browser theme editor.
  2. Create a file in that theme's directory called template.php or, if it already exists, edit the existing file.
  3. Insert the following code (replacing an entire phptemplate_xml_icon() function if it already exists), between the <?php ?> tags:
    function phptemplate_xml_icon ($url) {
    $icon_url = 'path/to/new/icon';
    if ($image = '<img src="'. $icon_url . '" alt="'. t('XML feed') . '" />') {
    return '<span class="xml-icon"><a href="'. check_url($url) .'">'. $image. '</a></span>';
    }
    }
  4. Visit administer » themes to register the new icon function.
  5. Enable the theme if necessary.