get_stylesheet() WP 1.5.0
Retrieve the name of the current theme directory.
This function retrieves the data with get_option('stylesheet')
.
The advantage of this function is that it passes the data through the stylesheet filter that plugins can use.
Works based on: get_option()
Basis of: get_stylesheet_directory_uri()
1 time = 0.003651s = very slow | 50000 times = 1.97s = fast | PHP 7.1.5, WP 4.8.2
Hooks from the function
Return
String. Stylesheet name.
Usage
get_stylesheet();
Examples
#1 Output the name (folder name) of the current theme
Suppose we are using "twentytwelve" theme, let's output it's folder name:
echo get_stylesheet(); // output: twentytwelve
Changelog
Since 1.5.0 | Introduced. |
Code of get_stylesheet() get stylesheet WP 5.6
function get_stylesheet() {
/**
* Filters the name of current stylesheet.
*
* @since 1.5.0
*
* @param string $stylesheet Name of the current stylesheet.
*/
return apply_filters( 'stylesheet', get_option( 'stylesheet' ) );
}Related Functions
From category: Other Theme Functions
- add_theme_support()
- bloginfo()
- body_class()
- current_theme_supports()
- get_custom_header_markup()
- get_custom_logo()
- get_header_image()
- get_header_image_tag()
- get_header_textcolor()
- get_header_video_url()
- get_page_templates()
- get_post_class()
- get_query_template()
- get_template()
- get_theme_mod()
- get_theme_mods()
- get_theme_root()
- has_custom_logo()
- has_header_image()
- has_header_video()
- is_child_theme()
- is_header_video_active()
- is_multi_author()
- post_class()
- register_nav_menu()
- register_nav_menus()
- register_theme_directory()
- remove_theme_mod()
- remove_theme_mods()
- remove_theme_support()
- search_theme_directories()
- set_theme_mod()
- single_month_title()
- the_custom_header_markup()