Title: WP_Theme::__get
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_Theme::__get( string $offset ): mixed

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#wp--skip-link--target)

__get() magic method for properties formerly returned by [current_theme_info()](https://developer.wordpress.org/reference/functions/current_theme_info/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#parameters)󠁿

 `$offset`stringrequired

Property to get.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#return)󠁿

 mixed Property value.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#source)󠁿

    ```php
    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 );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp-theme.php#L591)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp-theme.php#L591-L625)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Theme::get_template_directory()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/wp_theme/get_screenshot/)`wp-includes/class-wp-theme.php` |

Returns the main screenshot file for the theme.

  | 
| [WP_Theme::get_theme_root()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/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()](https://developer.wordpress.org/reference/classes/wp_theme/get/)`wp-includes/class-wp-theme.php` |

Gets a raw, unformatted theme header.

  | 
| [WP_Theme::parent()](https://developer.wordpress.org/reference/classes/wp_theme/parent/)`wp-includes/class-wp-theme.php` |

Returns reference to the parent theme.

  | 
| [WP_Theme::display()](https://developer.wordpress.org/reference/classes/wp_theme/display/)`wp-includes/class-wp-theme.php` |

Gets a theme header, formatted and translated for display.

  | 
| [WP_Theme::offsetGet()](https://developer.wordpress.org/reference/classes/wp_theme/offsetget/)`wp-includes/class-wp-theme.php` |  |

[Show 6 more](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme/__get/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme%2F__get%2F)
before being able to contribute a note or feedback.