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

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

$theme_dir = get_template_directory();  
$child_theme_dir = get_stylesheet_directory();
未能解决您的问题?

请提交 联系工单

闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 11:32:51

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: