Changeset 3655 for trunk/wp-includes/template-functions-category.php
- Timestamp:
- 03/21/2006 04:26:50 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/template-functions-category.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-category.php
r3605 r3655 377 377 378 378 $defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 379 'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1 );379 'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, $exclude => '', $include => ''); 380 380 $r = array_merge($defaults, $r); 381 $r['orderby'] = "cat_" . $r['orderby']; 381 $r['orderby'] = "cat_" . $r['orderby']; // restricts order by to cat_ID and cat_name fields 382 382 extract($r); 383 383 384 $exclusions = '';385 $having = '';386 384 $where = 'cat_ID > 0'; 385 $inclusions = ''; 386 if ( !empty($include) ) { 387 $child_of = 0; //ignore child_of and exclude params if using include 388 $exclude = ''; 389 $incategories = preg_split('/[\s,]+/',$include); 390 if ( count($incategories) ) { 391 foreach ( $incategories as $incat ) { 392 if (empty($inclusions)) 393 $inclusions = ' AND ( cat_ID = ' . intval($incat) . ' '; 394 else 395 $inclusions .= ' OR cat_ID = ' . intval($incat) . ' '; 396 } 397 } 398 } 399 if (!empty($inclusions)) 400 $inclusions .= ')'; 401 $where .= $inclusions; 387 402 388 403 $exclusions = ''; … … 391 406 if ( count($excategories) ) { 392 407 foreach ( $excategories as $excat ) { 393 $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; 394 // TODO: Exclude children of excluded cats? 408 if (empty($exclusions)) 409 $exclusions = ' AND ( cat_ID <> ' . intval($excat) . ' '; 410 else 411 $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; 412 // TODO: Exclude children of excluded cats? Note: children are getting excluded 395 413 } 396 414 } 397 415 } 416 if (!empty($exclusions)) 417 $exclusions .= ')'; 398 418 $exclusions = apply_filters('list_cats_exclusions', $exclusions ); 399 419 $where .= $exclusions; 400 420 421 $having = ''; 401 422 if ( $hide_empty ) { 402 423 if ( 'link' == $type )
Note:
See TracChangeset
for help on using the changeset viewer.