Sort the category list so that index associations are made non-sparse.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-11-12 23:08:51 +00:00
parent 93f05160ec
commit acfb79c47e
2 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ function get_the_category($id = false) {
} }
if ($category_cache[$id]) { if ($category_cache[$id]) {
return $category_cache[$id]; $categories = $category_cache[$id];
} else { } else {
$categories = $wpdb->get_results(" $categories = $wpdb->get_results("
SELECT category_id, cat_name, category_nicename, category_description, category_parent SELECT category_id, cat_name, category_nicename, category_description, category_parent
@ -16,8 +16,10 @@ function get_the_category($id = false) {
WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$id' WHERE $wpdb->post2cat.category_id = cat_ID AND $wpdb->post2cat.post_id = '$id'
"); ");
return $categories;
} }
sort($categories);
return $categories;
} }
function get_category_link($echo = false, $category_id, $category_nicename) { function get_category_link($echo = false, $category_id, $category_nicename) {