properly sort categories by name for the_category(). Props rob1n. fixes #1302

git-svn-id: http://svn.automattic.com/wordpress/trunk@4903 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-02-21 02:13:47 +00:00
parent 3bac160f13
commit 7438cb83d7
1 changed files with 5 additions and 1 deletions

View File

@ -71,13 +71,17 @@ global $post, $category_cache, $blog_id;
$categories = $category_cache[$blog_id][$id]; $categories = $category_cache[$blog_id][$id];
if ( !empty($categories) ) if ( !empty($categories) )
sort($categories); usort($categories, '_get_the_category_usort');
else else
$categories = array(); $categories = array();
return $categories; 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) { function get_the_category_by_ID($cat_ID) {
$cat_ID = (int) $cat_ID; $cat_ID = (int) $cat_ID;
$category = &get_category($cat_ID); $category = &get_category($cat_ID);