WP_Customize_Manager::get_template() WordPress Method

The WP_Customize_Manager::get_template() method is used to get the path of a template file for a given Customizer setting. This is useful for settings that need to display a template in the Customizer preview, such as for settings that control the display of a post list in the Customizer preview. The get_template() method takes two arguments: the setting ID and the template name. The setting ID is the ID of the setting to get the template for. The template name is the name of the template file, without the .php extension. So, for example, if you have a setting with the ID of "post_list_display" and you want to get the path of the template for that setting, you would use the following code: $template = $wp_customize->get_template( 'post_list_display', 'my-template' );

WP_Customize_Manager::get_template() #

Retrieves the template name of the previewed theme.


Return

(string) Template name.


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	public function get_template() {
		return $this->theme()->get_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.

Show More