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