From 6245f530427a311e9e2a6609d0415873eb56b369 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Fri, 2 Jan 2004 00:58:13 +0000 Subject: [PATCH] Query optimizations. git-svn-id: http://svn.automattic.com/wordpress/trunk@683 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/template-functions.php b/wp-includes/template-functions.php index b1f5a1ea3..c48a6ba17 100644 --- a/wp-includes/template-functions.php +++ b/wp-includes/template-functions.php @@ -1340,7 +1340,7 @@ function get_the_category() { return $categories; } -function get_category_link($echo = false, $category_id) { +function get_category_link($echo = false, $category_id, $category_nicename) { global $wpdb, $tablecategories, $post, $querystring_start, $querystring_equal, $siteurl, $blogfilename; $cat_ID = $category_id; $permalink_structure = get_settings('permalink_structure'); @@ -1349,7 +1349,7 @@ function get_category_link($echo = false, $category_id) { $file = "$siteurl/$blogfilename"; $link = $file.$querystring_start.'cat'.$querystring_equal.$cat_ID; } else { - $category_nicename = $wpdb->get_var("SELECT category_nicename FROM $tablecategories WHERE cat_ID = $category_id"); + if ('' == $category_nicename) $category_nicename = $wpdb->get_var("SELECT category_nicename FROM $tablecategories WHERE cat_ID = $category_id"); // Get any static stuff from the front $front = substr($permalink_structure, 0, strpos($permalink_structure, '%')); $link = $siteurl . $front . 'category/' . $category_nicename; @@ -1365,7 +1365,7 @@ function the_category($seperator = '') { echo ''; } else { @@ -1373,7 +1373,7 @@ function the_category($seperator = '') { foreach ($categories as $category) { $category->cat_name = stripslashes($category->cat_name); if (0 < $i) echo $seperator . ' '; - echo "$category->cat_name"; + echo "$category->cat_name"; ++$i; } } @@ -1491,7 +1491,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde $sort_column = 'cat_'.$sort_column; $query = " - SELECT cat_ID, cat_name, + SELECT cat_ID, cat_name, category_nicename, 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) @@ -1522,7 +1522,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 = ''; + $link = ''; $link .= stripslashes($cat_name).''; if (intval($optioncount) == 1) { $link .= '  ('.$category->cat_count.')';