page_template_dropdown() – Prints out option HTML elements for the page templates drop-down.

You appear to be a bot. Output may be restricted

Description

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

Usage

page_template_dropdown( $default_template, $post_type );

Parameters

$default_template
( string ) optional – Optional. The template file name. Default empty.
$post_type
( string ) optional default: page – Optional. Post type to get templates for. Default 'post'.

Returns

void

Source

File name: wordpress/wp-admin/includes/template.php
Lines:

1 to 10 of 10
function page_template_dropdown( $default_template = '', $post_type = 'page' ) {
  $templates = get_page_templates( null, $post_type );

  ksort( $templates );

  foreach ( array_keys( $templates ) as $template ) {
    $selected = selected( $default_template, $templates[ $template ], false );
    echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>';
  }
}
 

 View on GitHub View on Trac