Blog/ How to override theme functions in Drupal 7

Before overriding theme functions, let us understand the concept of theme function.

In Drupal, a theme function is a PHP function that is used to output the HTML of any Drupal object. These functions are prefixed with theme_. All the functions that produce HTML are themeable and are invoked using theme() rather than being directly called.

We can override theme functions in template.php.

Find out the theme function which produces the output that you want to change.

Copy the code and paste it into template.php

Rename the function. "theme_functionname()" will be renamed as "YourThemeName_functionname()". For eg: "theme_username()" will be renamed as "yourthemename_username()".