WordPress at a glance

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()
1 time = 0.003651s = very slow | 50000 times = 1.97s = fast | PHP 7.1.5, WP 4.8.2
Hooks from the function

String. Stylesheet name.




#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


Since 1.5.0 Introduced.

Code of get_stylesheet() WP 5.5.1

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' ) );

From category: Other Theme Functions

vladlu 100vlad.lu
Editors: kama 100
No comments
    Log In . Register