Deprecate get_current_theme(). Use (string) wp_get_theme() to get the translated name of the theme. Keep the current_theme option for now. see #20103, see #20138.

git-svn-id: https://develop.svn.wordpress.org/trunk@20040 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-02-29 20:07:22 +00:00
parent 43913e382c
commit 6a4a8df204
2 changed files with 35 additions and 22 deletions

View File

@@ -356,24 +356,6 @@ function get_theme_roots() {
return $theme_roots;
}
/**
* 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.
*
* @since 1.5.0
*
* @return string
*/
function get_current_theme() {
if ( $theme = get_option( 'current_theme' ) )
return $theme;
return wp_get_theme()->get('Name');
}
/**
* Register a directory that contains themes.
*
@@ -791,7 +773,9 @@ function validate_current_theme() {
function get_theme_mods() {
$theme_slug = get_option( 'stylesheet' );
if ( false === ( $mods = get_option( "theme_mods_$theme_slug" ) ) ) {
$theme_name = get_current_theme();
$theme_name = get_option( 'current_theme' );
if ( false === $theme_name )
$theme_name = wp_get_theme()->get('Name');
$mods = get_option( "mods_$theme_name" ); // Deprecated location.
if ( is_admin() && false !== $mods ) {
update_option( "theme_mods_$theme_slug", $mods );
@@ -878,7 +862,12 @@ function remove_theme_mod( $name ) {
*/
function remove_theme_mods() {
delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
delete_option( 'mods_' . get_current_theme() );
// Old style.
$theme_name = get_option( 'current_theme' );
if ( false === $theme_name )
$theme_name = wp_get_theme()->get('Name');
delete_option( 'mods_' . $theme_name );
}
/**