Right way to call theme functions in Drupal

Drupal core and contrib modules define theme functions. These theme functions can be defined by themes as well.

hook_theme() implementations is where all the information exists. Theme functions are written as hook_foo() or hook_fooxyz(), but we should never call a theme function directly. By calling it directly we will lose the benefits of the Drupal theming layer such as overriding, suggestions, etc.

Example on how to call theme_image() the right way:

Right way:

print theme('image', array('path' => 'image/path/image.png', 'alt' => 'New image'));

Wrong way:

print theme_image(array('path' => 'image/path/image.png', 'alt' => 'New image'));

 

Further information and documentation can be found at https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme/7.