Use wp_dropdown_page()

git-svn-id: https://develop.svn.wordpress.org/trunk@10069 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-12-05 18:03:24 +00:00
parent a38974136d
commit e5f6baeedc
2 changed files with 11 additions and 9 deletions

View File

@ -1046,13 +1046,12 @@ function inline_edit_row( $type ) {
<label>
<span class="title"><?php _e( 'Parent' ); ?></span>
<select name="post_parent">
<?php if ( $bulk ) : ?>
<option value="-1"><?php _e('- No Change -'); ?></option>
<?php endif; // $bulk ?>
<option value="0"><?php _e( 'Main Page (no parent)' ); ?></option>
<?php parent_dropdown(); ?>
</select>
<?php
$dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0);
if ( $bulk )
$dropdown_args['show_option_no_change'] = __('- No Change -');
?>
<?php wp_dropdown_pages($dropdown_args); ?>
</label>
<?php if ( !$bulk ) : ?>

View File

@ -554,7 +554,8 @@ function wp_dropdown_pages($args = '') {
$defaults = array(
'depth' => 0, 'child_of' => 0,
'selected' => 0, 'echo' => 1,
'name' => 'page_id', 'show_option_none' => ''
'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
'option_none_value' => ''
);
$r = wp_parse_args( $args, $defaults );
@ -565,8 +566,10 @@ function wp_dropdown_pages($args = '') {
if ( ! empty($pages) ) {
$output = "<select name='$name' id='$name'>\n";
if ( $show_option_no_change )
$output .= "\t<option value='-1'>$show_option_no_change</option>";
if ( $show_option_none )
$output .= "\t<option value=''>$show_option_none</option>\n";
$output .= "\t<option value='$option_none_value'>$show_option_none</option>\n";
$output .= walk_page_dropdown_tree($pages, $depth, $r);
$output .= "</select>\n";
}