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



get_page_templates › WordPress Function

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:
  • (string[]) Array of template file names keyed by the template header name.
Definiert in:
Codex:
Changelog:
  • 4.7.0

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