WordPress开发者和主题制作者的搜索引擎



get_page_templates ›

Since1.5.0
已弃用n/a
get_page_templates ( $post = null, $post_type = 'page' )
参数: (2)
  • (WP_Post|null) $post Optional. The post being edited, provided for context.
    Required: No
    默认: null
  • (string) $post_type Optional. Post type to get the templates for. Default 'page'.
    Required: No
    默认: 'page'
返回:
  • (array) Key is the template name, value is the filename of the template
定义在:
文档:
Change Log:
  • 4.7.0

Get the Page Templates available in this theme



源码

function get_page_templates( $post = null, $post_type = 'page' ) {
	return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) );
}