get_template_part_{$slug}

動作鉤子
do_action( "get_template_part_{$slug}", $slug, $name, $args )
引數
  • (string) $slug The slug name for the generic template.
    Required:
  • (string|null) $name The name of the specialized template.
    Required:
  • (array) $args Additional arguments passed to the template.
    Required:
定義位置
相關勾子
get_template_partdefault_wp_template_part_areasdefault_template_typesget_block_templatesget_delete_post_link
相關方法
get_template_partget_page_template_slugget_templateget_template_directory_uri_get_block_templates_pathsget_template_hierarchy
引入
5.5.0
棄用
-

get_template_part_{$slug}是一個鉤子,當get_template_part函式被執行時被觸發。你可以使用這個鉤子來修改正在載入到你的主題中的模板部分。

在載入指定的模板零件檔案之前觸發。

鉤子名稱的動態部分$sslug是指通用模板部分的slug名稱。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
do_action( "get_template_part_{$slug}", $slug, $name, $args );
do_action( "get_template_part_{$slug}", $slug, $name, $args );
do_action( "get_template_part_{$slug}", $slug, $name, $args );

常見問題

FAQs
檢視更多 >