The Definitive Guide to Drupal 7

Overriding Theme Functions

Overriding theme functions is very similar to overriding template files. The main difference is that you are working with functions, and your overridden theme functions all reside in template.php. The steps involved in overriding a theme function are as follows:

  1. Find the original theme function by browsing through Drupal’s source code or checking
  2. Copy and paste it into your template.php file.
  3. Change the beginning of the function name from theme_ to yourthemename_.
  4. Save template.php, clear the site cache, and reload!

You are reading content from two chapters on Theme Development from The Definitive Guide to Drupal 7, written by Jacine Luisi and published by Apress on July 19, 2011. All rights reserved.