- Timestamp:
- 05/22/2017 08:23:49 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets/class-wp-widget-tag-cloud.php
r40806 r40816 54 54 } 55 55 56 $show_count = ! empty( $instance['count'] ); 57 56 58 /** 57 59 * Filters the taxonomy used in the Tag Cloud widget. … … 65 67 */ 66 68 $tag_cloud = wp_tag_cloud( apply_filters( 'widget_tag_cloud_args', array( 67 'taxonomy' => $current_taxonomy, 68 'echo' => false 69 'taxonomy' => $current_taxonomy, 70 'echo' => false, 71 'show_count' => $show_count, 69 72 ) ) ); 70 73 … … 103 106 $instance = array(); 104 107 $instance['title'] = sanitize_text_field( $new_instance['title'] ); 108 $instance['count'] = ! empty( $new_instance['count'] ) ? 1 : 0; 105 109 $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); 106 110 return $instance; … … 118 122 $current_taxonomy = $this->_get_current_taxonomy($instance); 119 123 $title_id = $this->get_field_id( 'title' ); 124 $count = isset( $instance['count'] ) ? (bool) $instance['count'] : false; 120 125 $instance['title'] = ! empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 121 126 … … 129 134 $input = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="%s" />'; 130 135 136 $count_checkbox = sprintf( 137 '<p><input type="checkbox" class="checkbox" id="%1$s" name="%2$s"%3$s /> <label for="%1$s">%4$s</label></p>', 138 $this->get_field_id( 'count' ), 139 $this->get_field_name( 'count' ), 140 checked( $count, true, false ), 141 __( 'Show tag counts' ) 142 ); 143 131 144 switch ( count( $taxonomies ) ) { 132 145 … … 137 150 break; 138 151 139 // Just a single tag cloud supporting taxonomy found, no need to display options152 // Just a single tag cloud supporting taxonomy found, no need to display a select. 140 153 case 1: 141 154 $keys = array_keys( $taxonomies ); 142 155 $taxonomy = reset( $keys ); 143 156 printf( $input, esc_attr( $taxonomy ) ); 157 echo $count_checkbox; 144 158 break; 145 159 146 // More than one tag cloud supporting taxonomy found, display options160 // More than one tag cloud supporting taxonomy found, display a select. 147 161 default: 148 162 printf( … … 163 177 } 164 178 165 echo '</select></p>' ;179 echo '</select></p>' . $count_checkbox; 166 180 } 167 181 }
Note: See TracChangeset
for help on using the changeset viewer.