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.
Source
File: wp-includes/class-wp-customize-manager.php
public function get_template() { return $this->theme()->get_template(); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.4.0 | Introduced. |