Ticket #11612: 11612.2.diff
File 11612.2.diff, 2.1 KB (added by , 15 years ago) |
---|
-
wp-includes/default-widgets.php
977 978 function widget( $args, $instance ) { 978 979 extract($args); 979 980 $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']); 981 $taxonomy = !empty($instance['taxonomy']) && is_taxonomy($instance['taxonomy']) ? $instance['taxonomy'] : 'post_tag'; 980 982 981 983 echo $before_widget; 982 984 if ( $title ) 983 985 echo $before_title . $title . $after_title; 984 986 echo '<div>'; 985 wp_tag_cloud( apply_filters('widget_tag_cloud_args', array()));987 wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $taxonomy) ) ); 986 988 echo "</div>\n"; 987 989 echo $after_widget; 988 990 } 989 991 990 992 function update( $new_instance, $old_instance ) { 991 993 $instance['title'] = strip_tags(stripslashes($new_instance['title'])); 994 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); 992 995 return $instance; 993 996 } 994 997 995 998 function form( $instance ) { 999 $current_tax = isset($instance['taxonomy']) && is_taxonomy($instance['taxonomy']) ? $instance['taxonomy'] : 'post_tag'; 996 1000 ?> 997 1001 <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label> 998 1002 <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php if (isset ( $instance['title'])) {echo esc_attr( $instance['title'] );} ?>" /></p> 999 <?php 1003 <p><label for="<?php echo $this->get_field_id('taxonomy'); ?>"><?php _e('Taxonomy:') ?></label> 1004 <select class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>"> 1005 <?php foreach ( get_object_taxonomies('post') as $tax ) : 1006 $t = get_taxonomy($tax); 1007 if ( empty($t->label) ) 1008 continue; 1009 ?> 1010 <option value="<?php echo esc_attr($tax) ?>" <?php selected($tax, $current_tax) ?>><?php echo $t->label ?></option> 1011 <?php endforeach; ?> 1012 </select></p><?php 1000 1013 } 1001 1014 } 1002 1015