[英]difference between get_template_directory_uri() and bloginfo('template_directory')
iam new to wordpress...now am trying to develop a wordpress theme from my existing html template.And iam confused with difference between get_template_directory_uri() and bloginfo('template_directory') .. From some other site i found that both are doing same. 我是wordpress的新手...现在正在尝试从我现有的html模板开发一个wordpress主题。而iam则与get_template_directory_uri()和bloginfo('template_directory')之间的区别感到困惑。 。 can anyone help for knowing the difference? 任何人都可以帮助您了解差异吗? if both are same please let me know which is best to use 如果两者相同,请让我知道最好使用哪个
thank you 谢谢
There is absolutely no difference between the two (prior to WP 2.6, template_directory generated a local path, but now, it's the same). 两者之间绝对没有区别(在WP 2.6之前,template_directory生成了本地路径,但现在是相同的)。 get_bloginfo( 'template_directory' )
and get_bloginfo( 'template_url' )
simply return get_template_directory_uri()
. 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' )
Another difference you can see that get_bloginfo( 'template_directory' ) works without echo so you couldn't take it into variable if need whereas you can get_template_directory_uri() into variable. 您可以看到另一个区别,即get_bloginfo('template_directory')在没有回声的情况下可以工作,因此如果需要,您不能将其放入变量中,而可以将get_template_directory_uri()放入变量中。 So according to your task differentiation, you can chose one of them. 因此,根据您的任务差异,您可以选择其中之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.