get_template_part

動作鉤子
do_action( 'get_template_part', $slug, $name, $templates, $args )
引數
  • (string) $slug The slug name for the generic template.
    Required:
  • (string) $name The name of the specialized template.
    Required:
  • (string[]) $templates Array of template files to search for, in order.
    Required:
  • (array) $args Additional arguments passed to the template.
    Required:
定義位置
相關勾子
get_template_part_slugget_block_templatedefault_wp_template_part_areasget_block_templatesdefault_template_types
相關方法
get_template_partget_templateblock_template_partget_template_hierarchyget_template_directory_get_block_templates_paths
引入
5.5.0
棄用
-

get_template_part函式是用來在你的主題中包含一個模板部分: 該函式允許你將你的主題的特定部分載入到你的網站的頁面中。

在試圖定位和載入模板零件之前發生觸發。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( 'get_template_part', $slug, $name, $templates, $args );
do_action( 'get_template_part', $slug, $name, $templates, $args );
do_action( 'get_template_part', $slug, $name, $templates, $args );

常見問題

FAQs
檢視更多 >