wp-includes/template.php

WP檔案 21
Template loading functions.
函式/鉤子名 描述
wp_before_load_template (動作鉤子) wp_before_load_template 動作是一個 WordPress 鉤子。在載入模板之前,該鉤子允許外掛或主題在載入模板之前進行操作。
wp_after_load_template (動作鉤子) wp_after_load_template:載入並執行請求的模板後,將在 WordPress 中觸發此操作鉤子。它允許開發人員在模板載入後新增額外的處理或修改。這對於新增自定義資料、更改模板輸出或向
{$type}_template_hierarchy (過濾鉤子) “{$type}_template_hierarchy”是 WordPress 中的一個動作鉤子,它在為特定媒體型別載入模板的過程中執行,如“$type”所定義。 它允許開發人員將自定義邏輯新增到模板
{$type}_template (過濾鉤子) {$type}_template 是 WordPress 中的過濾器鉤子,它修改由”$type” 定義的特定媒體型別的模板檔案的路徑。 這可用於更改媒體在網站前端的顯示方式。
locate_template (函式) locate_template: 這是WordPress中的一個函式,允許你在你的主題或外掛中找到一個模板檔案。你可以用這個函式為特定的頁面、文章型別或其他內容以程式設計方式定位模板檔案,然後在你的程
load_template (函式) load_template: 這是WordPress中的一個函式,用來載入一個模板檔案。你可以使用這個函式為你網站上的一個頁面、文章或其他內容載入一個特定的模板檔案。
get_taxonomy_template (函式) get_taxonomy_template: 這個函式檢索分類法檔案模板檔案的路徑。它接受一個引數:要檢索模板的分類法名稱。它以字串形式返回模板檔案的路徑。
get_tag_template (函式) get_tag_template: 這個函式檢索到標籤存檔模板檔案的路徑。它不接受任何引數,並以字串形式返回模板檔案的路徑。
get_singular_template (函式) get_singular_template函式是一個WordPress函式,用於檢索特定文章型別的單一文章模板檔案的路徑: 這個函式把文章型別作為引數,並返回到單一的文章模板檔案的路徑。
get_single_template (函式) get_single_template函式是一個WordPress函式,用於檢索特定文章型別的單一文章模板檔案的路徑: 這個函式把文章型別作為一個引數,並返回單個文章模板檔案的路徑。
get_search_template (函式) get_search_template函式是一個WordPress函式,用於檢索搜尋結果模板檔案的路徑: 這個函式不接受任何引數,並返回搜尋結果模板檔案的路徑。
get_query_template (函式) get_query_template函式是一個WordPress函式,用於檢索用於特定查詢的模板檔案的路徑: 這個函式把模板型別作為一個引數,並返回模板檔案的路徑。
get_privacy_policy_template (函式) get_privacy_policy_template函式是一個WordPress函式,用於檢索隱私政策模板檔案的路徑: 這個函式不接受任何引數,並返回隱私政策模板檔案的路徑。
get_post_type_archive_template (函式) get_post_type_archive_template函式是一個WordPress函式,用於檢索指定文章型別的存檔模板檔案的路徑: 這個函式以文章型別名稱為引數,並返回指定文章型別的存檔模板檔案
get_page_template (函式) get_page_template函式是一個WordPress函式,用於檢索一個頁面的模板名稱: 該函式接受一個引數,即你想檢索模板名稱的頁面的ID: 該函式返回該頁面的模板名稱。
get_index_template (函式) get_index_template: 這個函式用來檢索當前WordPress主題的索引模板檔案的路徑。索引模板檔案通常用於在主頁上顯示部落格文章。
get_home_template (函式) get_home_template: 這個函式用來檢索當前WordPress主題的主模板檔案的路徑。主頁模板檔案通常用於在主頁上顯示部落格文章。
get_front_page_template (函式) get_front_page_template: 這個函式用來檢索當前WordPress主題的首頁模板檔案的路徑。前端頁面模板檔案用於顯示網站的靜態前端頁面。
get_embed_template (函式) get_embed_template: 這個函式用來檢索當前WordPress主題的嵌入模板檔案的路徑。嵌入模板檔案通常用於顯示來自其他網站的嵌入內容。
get_date_template (函式) get_date_template:該函式返回用於顯示當前文章或頁面的日期的模板檔案的路徑。
get_category_template (函式) get_category_template: 這個函式檢索應該用於顯示給定類別的模板檔案。
get_author_template (函式) get_author_template: 這個函式檢索到當前主題的作者模板的路徑。
get_attachment_template (函式) get_attachment_template: 這個函式檢索當前主題的附件模板的路徑。
get_archive_template (函式) get_archive_template: 這個函式返回當前文章型別的存檔模板檔案的路徑。如果沒有找到模板,它返回一個空字串。
get_404_template (函式) get_404_template: 這個函式用來獲取404模板檔案的路徑,當一個頁面或文章無法找到時,就會使用這個檔案。

常見問題

FAQs
檢視更多 >