[wp-hackers] Constant for Theme File Path

Chip Bennett chip at chipbennett.net
Fri Jan 7 19:17:44 UTC 2011


I need to check for the existence of the default Theme (i.e. TwentyTen),
which is easy enough: use file_exists() to find twentyten/style.css.

WordPress has a defined constant, WP_PLUGIN_DIR, for retrieving the file
path (not URL) of the directory in which Plugins are installed. Does a
similar constant (or other means) exist for retrieving the file path (not
URL) of the directory in which Themes are installed?

Currently, I'm hacking WP_PLUGIN_DIR, like such:

if ( file_exists( rtrim( WP_PLUGIN_DIR, 'plugins' ) .
'themes/twentyten/style.css' ) ) {

// do stuff

}


This works, but intuition tells me that there has to be a more direct way.
I've searched through the constants, bloginfo(), etc. and cannot find
anything resembling WP_THEMES_DIR or WP_TEMPLATE_DIR (or anything that
likewise returns a file path for the Themes directory).

Does any such means exist? If not, is there a better work-around than the
one I'm using?

Chip


More information about the wp-hackers mailing list