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函数是用来在你的主题中包含一个模板部分: 该函数允许你将你的主题的特定部分加载到你的网站的页面中。

在试图定位和加载模板零件之前发生触发。

do_action( 'get_template_part', $slug, $name, $templates, $args );

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 11:36:30

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: