Un motore di ricerca WordPress per sviluppatori e autori di temi



page_template_dropdown ›

Da1.5.0
Deprecaton/a
page_template_dropdown ( $default = '', $post_type = 'page' )
Parametri: (2)
  • (string) $default Optional. The template file name. Default empty.
    Richiesto: No
    Default: (vuoto)
  • (string) $post_type Optional. Post type to get templates for. Default 'post'.
    Richiesto: No
    Default: 'page'
Definito a:
Codex:
ChangeLog:
  • 4.7.0

Print out option HTML elements for the page templates drop-down.



Sorgenti

function page_template_dropdown( $default = '', $post_type = 'page' ) {
	$templates = get_page_templates( null, $post_type );
	ksort( $templates );
	foreach ( array_keys( $templates ) as $template ) {
		$selected = selected( $default, $templates[ $template ], false );
		echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>';
	}
}