简体   繁体   English

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

[英]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()

See this post for more information. 有关更多信息,请参见此帖子

使用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.

相关问题 Wordpress get_template_directory_uri()和bloginfo('template_directory')使用HTTPS返回不同的结果 - Wordpress get_template_directory_uri() and bloginfo('template_directory') return different results with HTTPS Wordpress bloginfo('template_directory')无法在jquery中运行 - Wordpress bloginfo('template_directory') not working in jquery get_template_directory_uri()与将图片上传到Wordpress网站之间的区别 - Difference between get_template_directory_uri() and upload images to wordpress site CSS不与get_template_directory_uri()排队 - Css not enqueueing with get_template_directory_uri() get_template_directory_uri()不返回字符串 - get_template_directory_uri() not returning string wordpress bloginfo('template_directory'); 使用twig解析为字符串 - wordpress bloginfo('template_directory'); parsing as a string using twig jQuery中要在管理面板中使用的bloginfo('template_directory') - bloginfo('template_directory') in jQuery to be used in Admin Panel PHP变量不显示使用bloginfo的图像('template_directory') - PHP Variable not displaying image that uses bloginfo('template_directory') 在functions.php中使用bloginfo('template_directory') - use bloginfo('template_directory') in functions.php 如何将get_bloginfo('template_directory')编辑为localhost而不是真实域? - How to edit get_bloginfo('template_directory') to localhost instead of real domain?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM