theme_templates

过滤钩子
apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type )
参数
  • (string[]) $post_templates Array of template header names keyed by the template file name.
    Required:
  • (WP_Theme) $theme The theme object.
    Required:
  • (WP_Post|null) $post The post being edited, provided for context, or null.
    Required:
  • (string) $post_type Post type to get the templates for.
    Required:
定义位置
相关勾子
print_media_templatestype_templatetheme_post_type_templatescomments_templatetheme_locale
相关方法
get_embed_templateget_home_templateget_templateget_page_templateslocate_templateget_page_template
引入
4.9.6
弃用
-

theme_templates是一个数组,用来保存你的主题中所有可用的模板。你可以使用这个数组来为特定的页面或文章以编程方式设置模板。theme_templates数组是一个关联数组,其中键是模板名称,值是模板文件的完整路径。

过滤主题的页面模板的列表。

$post_templates = (array) apply_filters( 'theme_templates', $post_templates, $this, $post, $post_type );

常见问题

FAQs
查看更多 >
闪电侠

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

2025-12-15 01:36:45

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

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

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