WP_Theme::get_template() WordPress Method

The WP_Theme::get_template() method is used to retrieve the path of a template file within a theme. This method is useful for retrieving the path of a template file so that it can be included within another template file. For example, if you wanted to include the contents of a sidebar template file within a page template file, you would use the WP_Theme::get_template() method to retrieve the path of the sidebar template file.

WP_Theme::get_template() #

Returns the directory name of the theme’s “template” files, inside the theme root.


Description

In the case of a child theme, this is the directory name of the parent theme. Otherwise, the get_template() is the same as get_stylesheet().


Top ↑

Return

(string) Template


Top ↑

Source

File: wp-includes/class-wp-theme.php

	public function get_template() {
		return $this->template;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.