Make WordPress Core

Changeset 8666


Ignore:
Timestamp:
08/18/2008 11:40:41 PM (16 years ago)
Author:
ryan
Message:

Revert tag cloud changes in 8540 and 8569. They broke tag sorting. see #6015

File:
1 edited

Legend:

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

    r8574 r8666  
    351351        return;
    352352
    353     foreach ( $tags as $key => $tag ) {
    354         $link = get_tag_link( $tag->term_id );
    355         if ( is_wp_error( $link ) )
    356             return false;
    357 
    358         $tags[ $key ]->link = $link;
    359         $tags[ $key ]->id = $tag->term_id;
    360     }
    361 
    362353    $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
     354
     355    if ( is_wp_error( $return ) )
     356        return false;
    363357
    364358    $return = apply_filters( 'wp_tag_cloud', $return, $args );
     
    384378    global $wp_rewrite;
    385379    $defaults = array(
    386         'smallest' => 8, 'largest' => 22, 'unit' => 'pt',
    387         'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
    388         'single_text' => '%d topic', 'multiple_text' => '%d topics'
     380        'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
     381        'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC'
    389382    );
    390383    $args = wp_parse_args( $args, $defaults );
     
    393386    if ( empty( $tags ) )
    394387        return;
    395 
    396     $counts = array();
    397     foreach ( (array) $tags as $key => $tag )
    398         $counts[ $key ] = $tag->count;
     388    $counts = $tag_links = array();
     389    foreach ( (array) $tags as $tag ) {
     390        $counts[$tag->name] = $tag->count;
     391        $tag_links[$tag->name] = get_tag_link( $tag->term_id );
     392        if ( is_wp_error( $tag_links[$tag->name] ) )
     393            return $tag_links[$tag->name];
     394        $tag_ids[$tag->name] = $tag->term_id;
     395    }
    399396
    400397    $min_count = min( $counts );
     
    427424    $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
    428425
    429     foreach ( $counts as $key => $count ) {
    430         $tag_link = clean_url( $tags[ $key ]->link );
    431         $tag_id = $tags[ $key ]->id;
    432         $tag_name = $tags[ $key ]->name;
    433         $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext( $single_text, $multiple_text, $count ), $count ) ) . "'$rel style='font-size: " .
     426    foreach ( $counts as $tag => $count ) {
     427        $tag_id = $tag_ids[$tag];
     428        $tag_link = clean_url($tag_links[$tag]);
     429        $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . "'$rel style='font-size: " .
    434430            ( $smallest + ( ( $count - $min_count ) * $font_step ) )
    435             . "$unit;'>$tag_name</a>";
     431            . "$unit;'>$tag</a>";
    436432    }
    437433
Note: See TracChangeset for help on using the changeset viewer.