WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/29/2007 04:54:45 AM (14 years ago)
Author:
markjaquith
Message:

switch to term_id and name for category sorting. see #4189. sort by term_id for category permalinks, by name for get_the_category(). fixes #4335 for trunk. Props Erik Barzeski for the find.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r5568 r5590  
    7070
    7171    if ( !empty($categories) )
    72         usort($categories, '_get_the_category_usort');
     72        usort($categories, '_usort_terms_by_name');
    7373    else
    7474        $categories = array();
     
    7777}
    7878
    79 function _get_the_category_usort($a, $b) {
    80     return strcmp($a->category_name, $b->category_name);
     79function _usort_terms_by_name($a, $b) {
     80    return strcmp($a->name, $b->name);
     81}
     82
     83function _usort_terms_by_ID($a, $b) {
     84    if ( $a->term_id > $b->term_id )
     85        return 1;
     86    elseif ( $a->term_id < $b->term_id )
     87        return -1;
     88    else
     89        return 0;
    8190}
    8291
Note: See TracChangeset for help on using the changeset viewer.