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
This commit is contained in:
parent
dd717f2e00
commit
abb1f0ce50
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user