' . intval($excat) . ' '; } } } if (intval($categories)==0){ $sort_column = 'cat_'.$sort_column; $query = " SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM $wpdb->categories WHERE cat_ID > 0 $exclusions ORDER BY $sort_column $sort_order"; $categories = $wpdb->get_results($query); } if (!count($category_posts)) { $now = current_time('mysql', 1); $cat_counts = $wpdb->get_results(" SELECT cat_ID, COUNT($wpdb->post2cat.post_id) AS cat_count FROM $wpdb->categories INNER JOIN $wpdb->post2cat ON (cat_ID = category_id) INNER JOIN $wpdb->posts ON (ID = post_id) WHERE post_status = 'publish' AND post_date_gmt < '$now' $exclusions GROUP BY category_id"); if (! empty($cat_counts)) { foreach ($cat_counts as $cat_count) { if (1 != intval($hide_empty) || $cat_count > 0) { $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count; } } } } if ( $optiondates ) { $cat_dates = $wpdb->get_results(" SELECT category_id, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM $wpdb->posts, $wpdb->post2cat WHERE post_status = 'publish' AND post_id = ID $exclusions GROUP BY category_id"); foreach ($cat_dates as $cat_date) { $category_timestamp["$cat_date->category_id"] = $cat_date->ts; } } $num_found=0; $thelist = ""; foreach ($categories as $category) { if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) { $num_found++; $link = 'category_description)) { $link .= 'title="'. sprintf(__("Read stuff about %s"), wp_specialchars($category->cat_name)) . '"'; } else { $link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category)) . '"'; } $link .= '>'; $link .= apply_filters('list_cats', $category->cat_name, $category).''; if ( (! empty($feed_image)) || (! empty($feed)) ) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= ''; } else { $link .= $name; } $link .= ''; if (empty($feed_image)) { $link .= ')'; } } if (intval($optioncount) == 1) { $link .= ' ('.intval($category_posts["$category->cat_ID"]).')'; } if ( $optiondates ) { if ( $optiondates == 1 ) $optiondates = 'Y-m-d'; $link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]); } if ($list) { $thelist .= "\t