page_template_dropdown()

 

File: wp-admin/includes/template.php

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>';
	}
}

参数:page_template_dropdown( string $default = '', string $post_type = 'page' )

The template file name. Post type to get templates for. Default 'post'.

$default

(string)
(Optional)
The template file name.

Default value: ''

$post_type

(string)
(Optional)
Post type to get templates for. Default 'post'.

Default value: 'page'

{acontent3}

You must log in before being able to contribute a note or feedback.

16.67% (1) 次Baidu访问
16.67% (1) 次Google访问
66.67% (4) 次Sogou访问
  • 蜘蛛:Baidu,1次,更新时间:2019-04-24 22:53:00
  • 蜘蛛:Google,1次,更新时间:2019-05-10 05:48:06
  • 蜘蛛:Sogou,4次,更新时间:2019-05-06 06:37:20

参与评论