From bf97881f985dbd63804d2a0f63e11b4fecc7dacf Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 29 Feb 2012 19:27:54 +0000 Subject: [PATCH] (string) WP_Theme is now the theme name, translated. Good replacement for get_current_theme(); better than wp_get_theme()->display('Name'). see #20103, see #20138. git-svn-id: http://svn.automattic.com/wordpress/trunk@20039 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyeleven/inc/theme-options.php | 2 +- wp-includes/class-wp-theme.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/wp-content/themes/twentyeleven/inc/theme-options.php b/wp-content/themes/twentyeleven/inc/theme-options.php index f1d6c4b3d8..0f650a349d 100644 --- a/wp-content/themes/twentyeleven/inc/theme-options.php +++ b/wp-content/themes/twentyeleven/inc/theme-options.php @@ -314,7 +314,7 @@ function twentyeleven_theme_options_render_page() { ?>
-

+

diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index d82b105304..a58a8acc55 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -238,6 +238,15 @@ final class WP_Theme implements ArrayAccess { } } + /** + * When converting the object to a string, the theme name is returned. + * + * @return string Theme name, ready for display (translated) + */ + function __toString() { + return (string) $this->display('Name'); + } + /** * __isset() magic method for properties formerly returned by current_theme_info() */