Make WordPress Core

Changeset 5591


Ignore:
Timestamp:
05/29/2007 04:56:44 AM (16 years ago)
Author:
markjaquith
Message:

sort by cat_ID for category permalinks, by name for get_the_category(). fixes #4335 for 2.2. Props Erik Barzeski for the find.

Location:
branches/2.2/wp-includes
Files:
2 edited

Legend:

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

    r5289 r5591  
    8282function _get_the_category_usort($a, $b) {
    8383    return strcmp($a->category_name, $b->category_name);
     84}
     85
     86function _get_the_category_usort_by_ID($a, $b) {
     87    if ( $a->cat_ID > $b->cat_ID )
     88        return 1;
     89    elseif ( $a->cat_ID < $b->cat_ID )
     90        return -1;
     91    else
     92        return 0;
    8493}
    8594
  • branches/2.2/wp-includes/link-template.php

    r5289 r5591  
    7878        if (strpos($permalink, '%category%') !== false) {
    7979            $cats = get_the_category($post->ID);
     80            if ( $cats )
     81                usort($cats, '_get_the_category_usort_by_ID'); // order by ID
    8082            $category = $cats[0]->category_nicename;
    8183            if ( $parent=$cats[0]->category_parent )
Note: See TracChangeset for help on using the changeset viewer.