Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_page_templates ›

Seit1.5.0
Veraltetn/v
get_page_templates ( $post = null, $post_type = 'page' )
Parameter: (2)
  • (WP_Post|null) $post Optional. The post being edited, provided for context.
    Erforderlich: Nein
    Standard: null
  • (string) $post_type Optional. Post type to get the templates for. Default 'page'.
    Erforderlich: Nein
    Standard: 'page'
Gibt zurück:
  • (array) Key is the template name, value is the filename of the template
Definiert in:
Codex:
Changelog:
  • 4.7.0

Get the Page Templates available in this theme



Quellcode

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