From abb1f0ce503ee16ad775a5e3cee7196cb19ecde3 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Wed, 21 Feb 2007 02:13:47 +0000 Subject: [PATCH] properly sort categories by name for the_category(). Props rob1n. fixes #1302 git-svn-id: https://develop.svn.wordpress.org/trunk@4903 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/category-template.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index f33446cc6d..1d84227035 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -71,13 +71,17 @@ global $post, $category_cache, $blog_id; $categories = $category_cache[$blog_id][$id]; if ( !empty($categories) ) - sort($categories); + usort($categories, '_get_the_category_usort'); else $categories = array(); return $categories; } +function _get_the_category_usort($a, $b) { + return strcmp($a->category_name, $b->category_name); +} + function get_the_category_by_ID($cat_ID) { $cat_ID = (int) $cat_ID; $category = &get_category($cat_ID);