Retrieves name of the active theme.
Source
function get_template() {
/**
* Filters the name of the active theme.
*
* @since 1.5.0
*
* @param string $template active theme's directory name.
*/
return apply_filters( 'template', get_option( 'template' ) );
}
Hooks
- apply_filters( ‘template’,
string $template ) Filters the name of the active theme.
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
Example
For example, if your current active theme is named
heli
, then:will output
heli
Note that get_template will return the parent theme’s name, NOT the child theme’s name, if a child theme is currently activated.
If you wish to obtain the current theme regardless if it is a child theme or the parent theme, use get_stylesheet
(reference question on wordpress stack exchange)