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



get_page_templates › WordPress Function

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'
返回:
  • (string[]) Array of template file names keyed by the template header name.
定义在:
文档:
Change Log:
  • 4.7.0

Gets 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 ) );
}