Changeset 6087 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 09/12/2007 12:49:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r6050 r6087 387 387 'hide_empty' => true, 'exclude' => '', 'include' => '', 388 388 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 389 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => ''); 389 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 390 'pad_counts' => false); 390 391 $args = wp_parse_args( $args, $defaults ); 391 392 $args['number'] = (int) $args['number']; … … 394 395 $args['child_of'] = 0; 395 396 $args['hierarchical'] = false; 397 $args['pad_counts'] = false; 396 398 } 397 399 … … 400 402 $args['hide_empty'] = 0; 401 403 $args['hierarchical'] = false; 404 $args['pad_counts'] = false; 402 405 } 403 406 extract($args, EXTR_SKIP); … … 511 514 } 512 515 513 /* 514 // Update category counts to include children. 516 // Update term counts to include children. 515 517 if ( $pad_counts ) 516 _pad_category_counts($type, $categories); 517 */ 518 _pad_term_counts($terms, $taxonomies[0]); 518 519 519 520 // Make sure we show empty categories that have children. … … 1130 1131 } 1131 1132 1133 // Recalculates term counts by including items from child terms 1134 // Assumes all relevant children are already in the $terms argument 1135 function _pad_term_counts(&$terms, $taxonomy) { 1136 $term_hier = _get_term_hierarchy($taxonomy); 1137 1138 if ( empty($term_hier) ) 1139 return; 1140 1141 foreach ( $terms as $key => $term ) { 1142 if ( $children = _get_term_children($term->term_id, $terms, $taxonomy) ) { 1143 foreach ( $children as $child ) { 1144 $child = get_term($child, $taxonomy); 1145 $terms[$key]->count += $child->count; 1146 } 1147 } 1148 } 1149 } 1150 1132 1151 // 1133 1152 // Default callbacks
Note: See TracChangeset
for help on using the changeset viewer.