繁体   English   中英

get_template_directory_uri()和bloginfo('template_directory')之间的区别

[英]difference between get_template_directory_uri() and bloginfo('template_directory')

我是wordpress的新手...现在正在尝试从我现有的html模板开发一个wordpress主题。而iam则与get_template_directory_uri()和bloginfo('template_directory')之间的区别感到困惑。 。 任何人都可以帮助您了解差异吗? 如果两者相同,请让我知道最好使用哪个

谢谢

两者之间绝对没有区别(在WP 2.6之前,template_directory生成了本地路径,但现在是相同的)。 get_bloginfo( 'template_directory' )get_bloginfo( 'template_url' )仅返回get_template_directory_uri()

有关更多信息,请参见此帖子

使用get_template_directory_uri()使脚本具有正确的路径入队bloginfo()用于显示有关您网站的信息,例如bloginfo('url'),bloginfo('name'),bloginfo('description'),bloginfo('template_url' )

您可以看到另一个区别,即get_bloginfo('template_directory')在没有回声的情况下可以工作,因此如果需要,您不能将其放入变量中,而可以将get_template_directory_uri()放入变量中。 因此,根据您的任务差异,您可以选择其中之一。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM