wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



get_page_templates › WordPress Function

Depuis1.5.0
Dépréciéen/a
get_page_templates ( $post = null, $post_type = 'page' )
Paramètres: (2)
  • (WP_Post|null) $post Optional. The post being edited, provided for context.
    Requis: Non
    Défaut: null
  • (string) $post_type Optional. Post type to get the templates for. Default 'page'.
    Requis: Non
    Défaut: 'page'
Retourne:
  • (string[]) Array of template file names keyed by the template header name.
Défini(e) dans:
Codex:
Changelog:
  • 4.7.0

Gets the page templates available in this theme.



Source

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