Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
get_template_directory() - 检索启用的主题的模板目录路径 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / get_template_directory()

get_template_directory()

检索启用的主题的模板目录路径


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "ac5e33dfc440ed9188bdfcdbe4f25e2c" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "1a4541a803a48108dcb6f8964b22d929" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

directory

templatemore...


返回

(string) 启用的主题的模板目录路径。


说明

用法

echo get_template_directory();

返回绝对服务器路径(例如:/home/user/public_html/wp-content/themes/my_theme),而不是URI。

在使用子主题的情况下,将返回父主题目录的绝对路径。使用get_stylesheet_directory()获取子主题目录的绝对路径。

要检索样式表目录的URI,请改用get_stylesheet_directory_uri()。

注意



源码

查看源码 官方文档


更新日志

版本描述
1.5.0开始引入

使用示例

  • 示例1

    引入一个PHP文件

    include( get_template_directory() . '/includes/my_file.php' );