Changeset 10896
- Timestamp:
- 04/08/2009 07:37:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-widgets.php
r10853 r10896 103 103 $show_rating = isset($instance['rating']) ? $instance['rating'] : false; 104 104 $show_images = isset($instance['images']) ? $instance['images'] : true; 105 $category = isset($instance['category']) ? $instance['category'] : false; 106 107 if ( is_admin() && !$category ) { 108 // Display All Links widget as such in the widgets screen 109 echo $before_widget . $before_title. __('All Links') . $after_title . $after_widget; 110 return; 111 } 105 112 106 113 $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget); … … 110 117 'show_images' => $show_images, 'show_description' => $show_description, 111 118 'show_name' => $show_name, 'show_rating' => $show_rating, 112 'c lass' => 'linkcat widget'119 'category' => $category, 'class' => 'linkcat widget' 113 120 ))); 114 121 } … … 121 128 $instance[$field] = 1; 122 129 } 130 $instance['category'] = intval($new_instance['category']); 123 131 124 132 return $instance; … … 128 136 129 137 //Defaults 130 $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false) ); 138 $instance = wp_parse_args( (array) $instance, array( 'images' => true, 'name' => true, 'description' => false, 'rating' => false, 'category' => false ) ); 139 $link_cats = get_terms( 'link_category'); 131 140 ?> 132 141 <p> 142 <label for="<?php echo $this->get_field_id('category'); ?>"> 143 <select id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" style="width: 97%;" /> 144 <option value=""><?php _e('All Links'); ?></option> 145 <?php 146 foreach ( $link_cats as $link_cat ) { 147 echo '<option value="' . intval($link_cat->term_id) . '"' 148 . ( $link_cat->term_id == $instance['category'] ? ' selected="selected"' : '' ) 149 . '>' . $link_cat->name . "</option>\n"; 150 } 151 ?> 152 </select></label><br /> 133 153 <label for="<?php echo $this->get_field_id('images'); ?>"> 134 154 <input class="checkbox" type="checkbox" <?php checked($instance['images'], true) ?> id="<?php echo $this->get_field_id('images'); ?>" name="<?php echo $this->get_field_name('images'); ?>" /> <?php _e('Show Link Image'); ?></label><br />
Note: See TracChangeset
for help on using the changeset viewer.