Add id arg to wp_dropdown_pages(). Props jeremyclarke. fixes #11433

git-svn-id: http://svn.automattic.com/wordpress/trunk@12882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-01-27 21:29:07 +00:00
parent 40e61f93e5
commit 0b2eaf01c5
1 changed files with 6 additions and 2 deletions

View File

@ -691,7 +691,8 @@ function wp_dropdown_pages($args = '') {
$defaults = array( $defaults = array(
'depth' => 0, 'child_of' => 0, 'depth' => 0, 'child_of' => 0,
'selected' => 0, 'echo' => 1, 'selected' => 0, 'echo' => 1,
'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '', 'name' => 'page_id', 'id' => '',
'show_option_none' => '', 'show_option_no_change' => '',
'option_none_value' => '' 'option_none_value' => ''
); );
@ -701,9 +702,12 @@ function wp_dropdown_pages($args = '') {
$pages = get_pages($r); $pages = get_pages($r);
$output = ''; $output = '';
$name = esc_attr($name); $name = esc_attr($name);
// Back-compat with old system where both id and name were based on $name argument
if ( empty($id) )
$id = $name;
if ( ! empty($pages) ) { if ( ! empty($pages) ) {
$output = "<select name=\"$name\" id=\"$name\">\n"; $output = "<select name=\"$name\" id=\"$id\">\n";
if ( $show_option_no_change ) if ( $show_option_no_change )
$output .= "\t<option value=\"-1\">$show_option_no_change</option>"; $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
if ( $show_option_none ) if ( $show_option_none )