get_template_directory()
get_template_directory()
检索当前主题目录。
Retrieve current theme directory.
返回(Return)
(string)模板目录路径。
源码(Source)
/** * Retrieve current theme directory. * * @since 1.5.0 * * @return string Template directory path. */ function get_template_directory() { $template = get_template(); $theme_root = get_theme_root( $template ); $template_dir = "$theme_root/$template"; /** * Filter the current theme directory path. * * @since 1.5.0 * * @param string $template_dir The URI 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 ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/theme.php:322 | 9 | 4 |
笔记(Notes)
包含一个PHP文件
get_template_directory() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_template_directory/