On this page
WP_Theme::__get( string $offset ): mixed
__get() magic method for properties formerly returned by current_theme_info()
Parameters
$offsetstring Required-
Property to get.
Return
mixed Property value.
Source
File: wp-includes/class-wp-theme.php. View all references
public function __get( $offset ) {
switch ( $offset ) {
case 'name':
case 'title':
return $this->get( 'Name' );
case 'version':
return $this->get( 'Version' );
case 'parent_theme':
return $this->parent() ? $this->parent()->get( 'Name' ) : '';
case 'template_dir':
return $this->get_template_directory();
case 'stylesheet_dir':
return $this->get_stylesheet_directory();
case 'template':
return $this->get_template();
case 'stylesheet':
return $this->get_stylesheet();
case 'screenshot':
return $this->get_screenshot( 'relative' );
// 'author' and 'description' did not previously return translated data.
case 'description':
return $this->display( 'Description' );
case 'author':
return $this->display( 'Author' );
case 'tags':
return $this->get( 'Tags' );
case 'theme_root':
return $this->get_theme_root();
case 'theme_root_uri':
return $this->get_theme_root_uri();
// For cases where the array was converted to an object.
default:
return $this->offsetGet( $offset );
}
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Theme::get_template_directory() wp-includes/class-wp-theme.php | Returns the absolute path to the directory of a theme’s “template” files. |
| WP_Theme::get_stylesheet_directory() wp-includes/class-wp-theme.php | Returns the absolute path to the directory of a theme’s “stylesheet” files. |
| WP_Theme::get_template() wp-includes/class-wp-theme.php | Returns the directory name of the theme’s “template” files, inside the theme root. |
| WP_Theme::get_stylesheet() wp-includes/class-wp-theme.php | Returns the directory name of the theme’s “stylesheet” files, inside the theme root. |
| WP_Theme::get_screenshot() wp-includes/class-wp-theme.php | Returns the main screenshot file for the theme. |
| WP_Theme::get_theme_root() wp-includes/class-wp-theme.php | Returns the absolute path to the directory of the theme root. |
| WP_Theme::get_theme_root_uri() wp-includes/class-wp-theme.php | Returns the URL to the directory of the theme root. |
| WP_Theme::get() wp-includes/class-wp-theme.php | Gets a raw, unformatted theme header. |
| WP_Theme::parent() wp-includes/class-wp-theme.php | Returns reference to the parent theme. |
| WP_Theme::display() wp-includes/class-wp-theme.php | Gets a theme header, formatted and translated for display. |
| WP_Theme::offsetGet() wp-includes/class-wp-theme.php |
Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme/__get