Linking To Images In Drupal Themes

Last modified: 
Sunday, March 29th, 2015

@TODO Update this with better drupal_get_path() alternatives.

If you want to link to an image stored in a Drupal theme without hardcoding the path, you can use the path_to_theme() function along with base_path(), as follows:

$path = base_path() . path_to_theme();

The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.