get_page_templates() WP 1.0
Get the Page Templates available in this theme
Works based on: WP_Theme::get_page_templates()
Basis of: page_template_dropdown()
No Hooks.
Return
String[]. Array of template file names keyed by the template header name.
Usage
get_page_templates( $post, $post_type );
- $post(WP_Post/null)
- The post being edited, provided for context.
Default: null - $post_type(string)
- Post type to get the templates for.
Default: 'page'
Changelog
Since 1.5.0 | Introduced. |
Since 4.7.0 | Added the $post_type parameter. |
Code of get_page_templates() get page templates WP 5.6
function get_page_templates( $post = null, $post_type = 'page' ) {
return array_flip( wp_get_theme()->get_page_templates( $post, $post_type ) );
}Related Functions
From category: Other Theme Functions
- add_theme_support()
- bloginfo()
- body_class()
- current_theme_supports()
- get_custom_header_markup()
- get_custom_logo()
- get_header_image()
- get_header_image_tag()
- get_header_textcolor()
- get_header_video_url()
- get_post_class()
- get_query_template()
- get_stylesheet()
- get_template()
- get_theme_mod()
- get_theme_mods()
- get_theme_root()
- has_custom_logo()
- has_header_image()
- has_header_video()
- is_child_theme()
- is_header_video_active()
- is_multi_author()
- post_class()
- register_nav_menu()
- register_nav_menus()
- register_theme_directory()
- remove_theme_mod()
- remove_theme_mods()
- remove_theme_support()
- search_theme_directories()
- set_theme_mod()
- single_month_title()
- the_custom_header_markup()