get_page_templates()
get_page_templates( WP_Post|null $post = null, string $post_type = ‘page’ )
获取此主题中可用的页模板。
Gets the page templates available in this theme.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$post | (WP_Post | null) | 可选 | 正在编辑的文章,提供上下文。 |
$post_type | (string) | 可选 | 获取模板的Post类型。 |
返回(Return)
(string[])由模板头名称键入的模板文件名数组。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
4.7.0 | wp-admin/includes/theme.php:125 | 5 | 2 |
笔记(Notes)
输出可用模板的列表
get_page_templates() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_page_templates/