Changeset 575
- Timestamp:
- 12/07/2003 09:25:05 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r572 r575 1349 1349 function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', 1350 1350 $file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) { 1351 global $tablecategories, $tableposts, $ wpdb;1351 global $tablecategories, $tableposts, $tablepost2cat, $wpdb; 1352 1352 global $pagenow, $siteurl, $blogfilename; 1353 1353 global $querystring_start, $querystring_equal, $querystring_separator; … … 1357 1357 $sort_column = 'cat_'.$sort_column; 1358 1358 1359 $query = " SELECT cat_ID, cat_name,"; 1360 $query .= " COUNT($tableposts.ID) AS cat_count,"; 1361 $query .= " DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth"; 1362 $query .= " FROM $tablecategories LEFT JOIN $tableposts ON cat_ID = post_category"; 1363 $query .= " WHERE cat_ID > 0 "; 1364 $query .= " GROUP BY post_category "; 1359 $query = " 1360 SELECT cat_ID, cat_name, 1361 COUNT($tablepost2cat.post_id) AS cat_count, 1362 DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth 1363 FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id) 1364 LEFT JOIN $tableposts ON (ID = post_id) 1365 WHERE cat_ID > 0 1366 GROUP BY category_id 1367 "; 1365 1368 if (intval($hide_empty) == 1) { 1366 1369 $query .= " HAVING cat_count > 0"; … … 1386 1389 foreach ($categories as $category) { 1387 1390 $cat_name = apply_filters('list_cats', $category->cat_name); 1388 $link = '<a href="'. $file.$querystring_start.'cat'.$querystring_equal.$category->cat_ID.'">';1391 $link = '<a href="'.get_category_link(0, $category->cat_ID).'" title="View all posts filed under ' . $category->cat_name . '">'; 1389 1392 $link .= stripslashes($cat_name).'</a>'; 1390 1393 if (intval($optioncount) == 1) {
Note: See TracChangeset
for help on using the changeset viewer.