WordPress 模板路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3863461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WordPress TEMPLATEPATH
提问by Sergei Basharov
Where in WordPress is TEMPLATEPATH initially set?
TEMPLATEPATH 最初在 WordPress 中的何处设置?
回答by Foxinni
TEMPLATEPATH has been deprecated.
模板路径已被弃用。
Use the following to include files:
使用以下命令来包含文件:
// Load entire ThemeSmith framework
include get_template_directory() . '/my-extra-functions.php';
回答by esafwan
It points to the template of your wordpress that is active.
它指向处于活动状态的 wordpress 模板。
<?php echo TEMPLATEPATH; ?>
This will give you the actual path.
这将为您提供实际路径。
Incase you are using a child theme, then this points to the childtheme. This is really handy because...
如果您使用的是子主题,则这指向子主题。这真的很方便,因为...
bloginfo('template_url')
This doesn't point to the child theme and creates problem for new developers using child theme.
这并不指向子主题,并且会给使用子主题的新开发人员带来问题。