Changeset 7670 for branches/2.5/wp-admin/includes/template.php
- Timestamp:
- 04/14/2008 07:31:46 PM (18 years ago)
- File:
-
- 1 edited
-
branches/2.5/wp-admin/includes/template.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/wp-admin/includes/template.php
r7596 r7670 176 176 } 177 177 178 function write_nested_categories( $categories ) {178 function write_nested_categories( $categories, $popular_ids = array() ) { 179 179 foreach ( $categories as $category ) { 180 echo "\n", '<li id="category-', $category['cat_ID'], '"><label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '</label>'; 180 $class = in_array( $category['cat_ID'], $popular_ids ) ? ' class="popular-category"' : ''; 181 echo "\n", "<li id='category-$category[cat_ID]'$class>", '<label for="in-category-', $category['cat_ID'], '" class="selectit"><input value="', $category['cat_ID'], '" type="checkbox" name="post_category[]" id="in-category-', $category['cat_ID'], '"', ($category['checked'] ? ' checked="checked"' : "" ), '/> ', wp_specialchars( apply_filters('the_category', $category['cat_name'] )), '</label>'; 181 182 182 183 if ( $category['children'] ) { … … 189 190 } 190 191 191 function dropdown_categories( $default = 0, $parent = 0 ) {192 write_nested_categories( get_nested_categories( $default, $parent ) );192 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) { 193 write_nested_categories( get_nested_categories( $default, $parent ), $popular_ids ); 193 194 } 194 195 … … 196 197 $categories = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number ) ); 197 198 199 $popular_ids = array(); 198 200 foreach ( (array) $categories as $category ) { 201 $popular_ids[] = $category->term_id; 199 202 $id = "popular-category-$category->term_id"; 200 203 ?> 201 204 202 <li id="<?php echo $id; ?>" >205 <li id="<?php echo $id; ?>" class="popular-category"> 203 206 <label class="selectit" for="in-<?php echo $id; ?>"> 204 207 <input id="in-<?php echo $id; ?>" type="checkbox" value="<?php echo (int) $category->term_id; ?>" /> … … 209 212 <?php 210 213 } 214 return $popular_ids; 211 215 } 212 216
Note: See TracChangeset
for help on using the changeset viewer.