簡體   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