WordPress.org

Make WordPress Core

Changeset 21867


Ignore:
Timestamp:
09/16/2012 04:51:12 PM (6 years ago)
Author:
nacin
Message:

Use selected() in default widgets. props SergeyBiryukov, iamfriendly. fixes #21451.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/default-widgets.php

    r21841 r21867  
    151151        <?php
    152152        foreach ( $link_cats as $link_cat ) {
    153             echo '<option value="' . intval($link_cat->term_id) . '"'
    154                 . ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' )
     153            echo '<option value="' . intval( $link_cat->term_id ) . '"'
     154                . selected( $instance['category'], $link_cat->term_id, false )
    155155                . '>' . $link_cat->name . "</option>\n";
    156156        }
     
    936936<?php
    937937        for ( $i = 1; $i <= 20; ++$i )
    938             echo "<option value='$i' " . ( $items == $i ? "selected='selected'" : '' ) . ">$i</option>";
     938            echo "<option value='$i' " . selected( $items, $i, false ) . ">$i</option>";
    939939?>
    940940    </select></p>
     
    11311131        <?php
    11321132            foreach ( $menus as $menu ) {
    1133                 $selected = $nav_menu == $menu->term_id ? ' selected="selected"' : '';
    1134                 echo '<option'. $selected .' value="'. $menu->term_id .'">'. $menu->name .'</option>';
     1133                echo '<option value="' . $menu->term_id . '"'
     1134                    . selected( $nav_menu, $menu->term_id, false )
     1135                    . '>'. $menu->name . '</option>';
    11351136            }
    11361137        ?>
Note: See TracChangeset for help on using the changeset viewer.