get_template() WordPress Function

The get_template() function is used to retrieve the path of the current theme's template file. This function is useful for retrieving the path of template files so that they can be included in other files.

get_template() #

Retrieves name of the active theme.


Return

(string) Template name.


Top ↑

More Information

This function retrieves the directory name of the current theme, without the trailing slash. In the case a child theme is being used, the directory name of the parent theme will be returned. Use get_stylesheet() to get the directory name of the child theme.


Top ↑

Source

File: wp-includes/theme.php

function get_template() {
	/**
	 * Filters the name of the active theme.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template active theme's directory name.
	 */
	return apply_filters( 'template', get_option( 'template' ) );
}


Top ↑

Changelog

Changelog
VersionDescription
1.5.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