Make WordPress Core

Changeset 575


Ignore:
Timestamp:
12/07/2003 09:25:05 AM (21 years ago)
Author:
saxmatt
Message:

list_cats to use new category link function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/b2-include/b2template.functions.php

    r572 r575  
    13491349function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc',
    13501350                   $file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) {
    1351     global $tablecategories, $tableposts, $wpdb;
     1351    global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
    13521352    global $pagenow, $siteurl, $blogfilename;
    13531353    global $querystring_start, $querystring_equal, $querystring_separator;
     
    13571357    $sort_column = 'cat_'.$sort_column;
    13581358
    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        ";
    13651368    if (intval($hide_empty) == 1) {
    13661369        $query .= " HAVING cat_count > 0";
     
    13861389    foreach ($categories as $category) {
    13871390        $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 . '">';
    13891392        $link .= stripslashes($cat_name).'</a>';
    13901393        if (intval($optioncount) == 1) {
Note: See TracChangeset for help on using the changeset viewer.