get_template_directory()

最后更新于:2021-11-27 00:53:08

get_template_directory()

Retrieves template directory path for current theme.

响应

(string) Path to current theme’s template directory.

源文件

文件: gc-includes/theme.php

function get_template_directory() {
	$template     = get_template();
	$theme_root   = get_theme_root( $template );
	$template_dir = "$theme_root/$template";

	/**
	 * Filters the current theme directory path.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir The path of the current theme directory.
	 * @param string $template     Directory name of the current theme.
	 * @param string $theme_root   Absolute path to the themes directory.
	 */
	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
}