Add show_option_none to wp_dropdown_pages(). Props ryanscheuermann. #2515

git-svn-id: http://svn.automattic.com/wordpress/trunk@3852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-06-07 23:27:25 +00:00
parent 3c8ed766e1
commit d56f944642
2 changed files with 5 additions and 3 deletions

View File

@ -29,8 +29,8 @@ include('admin-header.php');
<?php printf(__('A static <a href="%s">page</a> (select below)'), 'edit-pages.php'); ?>
</label>
<ul>
<li><?php printf(__('Show this page on the front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?></li>
<li><?php printf(__('Show the latest posts on this page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?></li>
<li><?php printf(__('Show this page on the front page: %s'), wp_dropdown_pages("name=page_on_front&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_on_front'))); ?></li>
<li><?php printf(__('Show the latest posts on this page: %s'), wp_dropdown_pages("name=page_for_posts&echo=0&show_option_none=".__('- Select -')."&selected=" . get_option('page_for_posts'))); ?></li>
</ul>
<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
<div id="front-page-warning" class="updated fade-ff0000">

View File

@ -228,7 +228,7 @@ function wp_dropdown_pages($args = '') {
parse_str($args, $r);
$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1,
'name' => 'page_id');
'name' => 'page_id', 'show_option_none' => '');
$r = array_merge($defaults, $r);
extract($r);
@ -237,6 +237,8 @@ function wp_dropdown_pages($args = '') {
if ( ! empty($pages) ) {
$output = "<select name='$name'>\n";
if ( $show_option_none )
$output .= "\t<option value=''>$show_option_none</option>\n";
$output .= walk_page_dropdown_tree($pages, $depth, $r);
$output .= "</select>\n";
}