get_block_template

過濾鉤子
apply_filters( 'get_block_template', $block_template, $id, $template_type )
引數
  • (WP_Block_Template|null) $block_template The found block template, or null if there isn't one.
    Required:
  • (string) $id Template unique identifier (example: theme_slug//template_slug).
    Required:
  • (array) $template_type Template type: `'wp_template'` or '`wp_template_part'`.
    Required:
定義位置
相關勾子
get_block_templatespre_get_block_templateget_block_file_templatepre_get_block_templatespre_get_block_file_template
相關方法
get_block_templateget_block_templatesget_block_file_template_get_block_template_filelocate_block_template_get_block_templates_files
引入
5.9.0
棄用
-

get_block_template: 這個函式檢索用於渲染塊型別的模板的路徑: 該函式將塊型別的名稱作為引數,並返回模板的路徑。

獲取查詢的塊模板物件後,對其進行過濾。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return apply_filters( 'get_block_template', $block_template, $id, $template_type );
return apply_filters( 'get_block_template', $block_template, $id, $template_type );
return apply_filters( 'get_block_template', $block_template, $id, $template_type );

常見問題

FAQs
檢視更多 >