Changeset 8666
- Timestamp:
- 08/18/2008 11:40:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r8574 r8666 351 351 return; 352 352 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 362 353 $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; 363 357 364 358 $return = apply_filters( 'wp_tag_cloud', $return, $args ); … … 384 378 global $wp_rewrite; 385 379 $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' 389 382 ); 390 383 $args = wp_parse_args( $args, $defaults ); … … 393 386 if ( empty( $tags ) ) 394 387 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 } 399 396 400 397 $min_count = min( $counts ); … … 427 424 $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : ''; 428 425 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: " . 434 430 ( $smallest + ( ( $count - $min_count ) * $font_step ) ) 435 . "$unit;'>$tag _name</a>";431 . "$unit;'>$tag</a>"; 436 432 } 437 433
Note: See TracChangeset
for help on using the changeset viewer.