简体   繁体   中英

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. 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). get_bloginfo( 'template_directory' ) and get_bloginfo( 'template_url' ) simply return 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. So according to your task differentiation, you can chose one of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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