Use selected() in default widgets. props SergeyBiryukov, iamfriendly. fixes #21451.
git-svn-id: http://core.svn.wordpress.org/trunk@21867 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
37537626e3
commit
a2b71e7fae
|
@ -150,8 +150,8 @@ class WP_Widget_Links extends WP_Widget {
|
||||||
<option value=""><?php _ex('All Links', 'links widget'); ?></option>
|
<option value=""><?php _ex('All Links', 'links widget'); ?></option>
|
||||||
<?php
|
<?php
|
||||||
foreach ( $link_cats as $link_cat ) {
|
foreach ( $link_cats as $link_cat ) {
|
||||||
echo '<option value="' . intval($link_cat->term_id) . '"'
|
echo '<option value="' . intval( $link_cat->term_id ) . '"'
|
||||||
. ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' )
|
. selected( $instance['category'], $link_cat->term_id, false )
|
||||||
. '>' . $link_cat->name . "</option>\n";
|
. '>' . $link_cat->name . "</option>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -935,7 +935,7 @@ function wp_widget_rss_form( $args, $inputs = null ) {
|
||||||
<select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
|
<select id="rss-items-<?php echo $number; ?>" name="widget-rss[<?php echo $number; ?>][items]">
|
||||||
<?php
|
<?php
|
||||||
for ( $i = 1; $i <= 20; ++$i )
|
for ( $i = 1; $i <= 20; ++$i )
|
||||||
echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>";
|
echo "<option value='$i' " . selected( $items, $i, false ) . ">$i</option>";
|
||||||
?>
|
?>
|
||||||
</select></p>
|
</select></p>
|
||||||
<?php endif; if ( $inputs['show_summary'] ) : ?>
|
<?php endif; if ( $inputs['show_summary'] ) : ?>
|
||||||
|
@ -1130,8 +1130,9 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
|
||||||
<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
|
<select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $menus as $menu ) {
|
foreach ( $menus as $menu ) {
|
||||||
$selected = $nav_menu == $menu->term_id ? ' selected="selected"' : '';
|
echo '<option value="' . $menu->term_id . '"'
|
||||||
echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>';
|
. selected( $nav_menu, $menu->term_id, false )
|
||||||
|
. '>'. $menu->name . '</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue