Changeset 1217
- Timestamp:
- 04/30/2004 06:28:50 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-category.php
r1203 r1217 250 250 if (!isset($r['feed'])) $r['feed'] = ''; 251 251 if (!isset($r['feed_image'])) $r['feed_image'] = ''; 252 253 list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image']); 254 } 255 256 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '') { 252 if (!isset($r['exclude'])) $r['exclude'] = ''; 253 254 list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image'], $r['exclude']); 255 } 256 257 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '') { 257 258 global $tablecategories, $tableposts, $tablepost2cat, $wpdb, $category_posts; 258 259 global $pagenow; … … 262 263 $file = get_settings('home') . '/' . get_settings('blogfilename'); 263 264 } 265 266 if (!empty($exclude)) { 267 $exclusions = ''; // initialize for safety 268 $excats = preg_split('/[\s,]+/',$exclude); 269 if (count($excats)) { 270 foreach ($excats as $excat) { 271 $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; 272 } 273 } 274 } 275 264 276 if (intval($categories)==0){ 265 277 $sort_column = 'cat_'.$sort_column; … … 268 280 SELECT cat_ID, cat_name, category_nicename, category_description, category_parent 269 281 FROM $tablecategories 270 WHERE cat_ID > 0 282 WHERE cat_ID > 0 $exclusions 271 283 ORDER BY $sort_column $sort_order"; 272 284 … … 276 288 $cat_counts = $wpdb->get_results(" SELECT cat_ID, 277 289 COUNT($tablepost2cat.post_id) AS cat_count 278 FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 290 FROM $tablecategories 291 LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 279 292 LEFT JOIN $tableposts ON (ID = post_id) 293 WHERE 1 = 1 $exclusions 280 294 GROUP BY category_id"); 281 295 foreach ($cat_counts as $cat_count) { … … 287 301 $cat_dates = $wpdb->get_results(" SELECT cat_ID, 288 302 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 289 FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 303 FROM $tablecategories 304 LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 290 305 LEFT JOIN $tableposts ON (ID = post_id) 306 WHERE 1 = 1 $exclusions 291 307 GROUP BY category_id"); 292 308 foreach ($cat_dates as $cat_date) {
Note: See TracChangeset
for help on using the changeset viewer.