如何使用get_template_directory和get_stylesheet_directory获取主题的目录路径?

你可以使用 get_template_directory()get_stylesheet_directory() 函数来获取当前主题的目录路径。 get_template_directory() 返回当前主题模板的目录路径,而 get_stylesheet_directory() 返回当前子主题的目录路径。例如:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$theme_dir = get_template_directory();
$child_theme_dir = get_stylesheet_directory();
$theme_dir = get_template_directory(); $child_theme_dir = get_stylesheet_directory();
$theme_dir = get_template_directory();  
$child_theme_dir = get_stylesheet_directory();
未能解决您的问题?

请提交 联系工单