mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-05 07:58:35 +01:00
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:
parent
3c8ed766e1
commit
d56f944642
@ -29,8 +29,8 @@ include('admin-header.php');
|
|||||||
<?php printf(__('A static <a href="%s">page</a> (select below)'), 'edit-pages.php'); ?>
|
<?php printf(__('A static <a href="%s">page</a> (select below)'), 'edit-pages.php'); ?>
|
||||||
</label>
|
</label>
|
||||||
<ul>
|
<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 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&selected=" . get_option('page_for_posts'))); ?></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>
|
</ul>
|
||||||
<?php if ( 'page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front') ) : ?>
|
<?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">
|
<div id="front-page-warning" class="updated fade-ff0000">
|
||||||
|
@ -228,7 +228,7 @@ function wp_dropdown_pages($args = '') {
|
|||||||
parse_str($args, $r);
|
parse_str($args, $r);
|
||||||
|
|
||||||
$defaults = array('depth' => 0, 'child_of' => 0, 'selected' => 0, 'echo' => 1,
|
$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);
|
$r = array_merge($defaults, $r);
|
||||||
extract($r);
|
extract($r);
|
||||||
|
|
||||||
@ -237,6 +237,8 @@ function wp_dropdown_pages($args = '') {
|
|||||||
|
|
||||||
if ( ! empty($pages) ) {
|
if ( ! empty($pages) ) {
|
||||||
$output = "<select name='$name'>\n";
|
$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 .= walk_page_dropdown_tree($pages, $depth, $r);
|
||||||
$output .= "</select>\n";
|
$output .= "</select>\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user