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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:39:14  来源:igfitidea点击:

WordPress TEMPLATEPATH

wordpress

提问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.

这并不指向子主题,并且会给使用子主题的新开发人员带来问题。