list_cats to use new category link function.

git-svn-id: http://svn.automattic.com/wordpress/trunk@575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-12-07 09:25:05 +00:00
parent 42df6fbd9a
commit cfa73eebd5
1 changed files with 11 additions and 8 deletions

View File

@ -1348,7 +1348,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
// out of the b2 loop
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc',
$file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) {
global $tablecategories, $tableposts, $wpdb;
global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
global $pagenow, $siteurl, $blogfilename;
global $querystring_start, $querystring_equal, $querystring_separator;
if (($file == 'blah') || ($file == '')) {
@ -1356,12 +1356,15 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
}
$sort_column = 'cat_'.$sort_column;
$query = " SELECT cat_ID, cat_name,";
$query .= " COUNT($tableposts.ID) AS cat_count,";
$query .= " DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth";
$query .= " FROM $tablecategories LEFT JOIN $tableposts ON cat_ID = post_category";
$query .= " WHERE cat_ID > 0 ";
$query .= " GROUP BY post_category ";
$query = "
SELECT cat_ID, cat_name,
COUNT($tablepost2cat.post_id) AS cat_count,
DAYOFMONTH(MAX(post_date)) AS lastday, MONTH(MAX(post_date)) AS lastmonth
FROM $tablecategories LEFT JOIN $tablepost2cat ON (cat_ID = category_id)
LEFT JOIN $tableposts ON (ID = post_id)
WHERE cat_ID > 0
GROUP BY category_id
";
if (intval($hide_empty) == 1) {
$query .= " HAVING cat_count > 0";
}
@ -1385,7 +1388,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
foreach ($categories as $category) {
$cat_name = apply_filters('list_cats', $category->cat_name);
$link = '<a href="'.$file.$querystring_start.'cat'.$querystring_equal.$category->cat_ID.'">';
$link = '<a href="'.get_category_link(0, $category->cat_ID).'" title="View all posts filed under ' . $category->cat_name . '">';
$link .= stripslashes($cat_name).'</a>';
if (intval($optioncount) == 1) {
$link .= '&nbsp;&nbsp;('.$category->cat_count.')';