Advertisements

get_current_theme

Definition:
function get_current_theme() {}

Retrieve current theme display name.
If the ‘current_theme’ option has already been set, then it will be returned instead. If it is not set, then each theme will be iterated over until both the current stylesheet and current template name.

Source code

function get_current_theme() {

	if ( $theme = get_option('current_theme') )

		return $theme;



	$themes = get_themes();

	$current_theme = 'Twenty Eleven';



	if ( $themes ) {

		$theme_names = array_keys( $themes );

		$current_template = get_option( 'template' );

		$current_stylesheet = get_option( 'stylesheet' );



		foreach ( (array) $theme_names as $theme_name ) {

			if ( $themes[$theme_name]['Stylesheet'] == $current_stylesheet &&

					$themes[$theme_name]['Template'] == $current_template ) {

				$current_theme = $themes[$theme_name]['Name'];

				break;

			}

		}

	}



	update_option('current_theme', $current_theme);



	return $current_theme;

}

1344

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: