Ticket #24656: 24656#category-template.php.patch
| File 24656#category-template.php.patch, 3.1 KB (added by , 13 years ago) |
|---|
-
category-template.php
498 498 * argument can be 'flat' (default), 'list', or 'array'. The flat value for the 499 499 * 'format' argument will separate tags with spaces. The list value for the 500 500 * 'format' argument will format the tags in a UL HTML list. The array value for 501 * the 'format' argument will return in PHP array type format. 501 * the 'format' argument will return in PHP array type format. The array value 502 * for the 'object' argument will return an array of objects with unformated 503 * data. 502 504 * 503 505 * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'. 504 506 * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'. … … 547 549 548 550 $return = apply_filters( 'wp_tag_cloud', $return, $args ); 549 551 550 if ( 'array' == $args['format'] || empty($args['echo']) )552 if ( 'array' == $args['format'] || 'object' == $args['format'] || empty($args['echo']) ) 551 553 return $return; 552 554 553 555 echo $return; … … 581 583 * argument can be 'flat' (default), 'list', or 'array'. The flat value for the 582 584 * 'format' argument will separate tags with spaces. The list value for the 583 585 * 'format' argument will format the tags in a UL HTML list. The array value for 584 * the 'format' argument will return in PHP array type format. 586 * the 'format' argument will return in PHP array type format. The array value 587 * for the 'object' argument will return an array of objects with unformated 588 * data. 585 589 * 586 590 * The 'tag_cloud_sort' filter allows you to override the sorting. 587 591 * Passed to the filter: $tags array and $args array, has to return the $tags array … … 671 675 $tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#'; 672 676 $tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key; 673 677 $tag_name = $tags[ $key ]->name; 674 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( call_user_func( $topic_count_text_callback, $real_count, $tag, $args ) ) . "' style='font-size: " . 675 str_replace( ',', '.', ( $smallest + ( ( $count - $min_count ) * $font_step ) ) ) 676 . "$unit;'>$tag_name</a>"; 678 679 if ($format == 'object') 680 { 681 $tag_record = new stdClass; 682 $tag_record->id = $tag_id; 683 $tag_record->url = $tag_link; 684 $tag_record->name = $tag_name; 685 $tag_record->slug = $tags[$key]->slug; 686 $tag_record->real_count = $real_count; 687 $tag_record->class = 'tag-link-'.$tag_id; 688 $tag_record->size = $smallest + ($count - $min_count); 689 $tag_record->font_size = ($smallest + (($count - $min_count) * $font_step)); 690 $a[] = $tag_record; 691 } else { 692 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . esc_attr( call_user_func( $topic_count_text_callback, $real_count, $tag, $args ) ) . "' style='font-size: " . 693 str_replace( ',', '.', ( $smallest + ( ( $count - $min_count ) * $font_step ) ) ) 694 . "$unit;'>$tag_name</a>"; 695 } 677 696 } 678 697 679 698 switch ( $format ) : 680 699 case 'array' : 700 case 'object' : 681 701 $return =& $a; 682 702 break; 683 703 case 'list' :