Created
April 26, 2012 09:09
-
-
Save WolfieZero/2497910 to your computer and use it in GitHub Desktop.
WordPress: return theme directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Place this function in your functions.php file to allow global access | |
* Update: 26 April 2012 11:35 - TEMPLATEPATH does the same job! | |
*/ | |
/** | |
* Theme Directory | |
* Returns the directory of the theme from root | |
* | |
* @param boolean $echo=false [description] | |
* @return string Depending on $echo this will return or echo the theme directory | |
*/ | |
function theme_dir($echo=false) { | |
$theme = explode('wp-content/themes/', get_bloginfo('template_url')); | |
$themeFolder = get_theme_root().'/'.$theme[1]; | |
if ($echo) | |
echo $themeFolder; | |
else | |
return $themeFolder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment