Index: category-template.php
===================================================================
--- category-template.php (revision 24527)
+++ category-template.php (working copy)
@@ -498,7 +498,9 @@
* argument can be 'flat' (default), 'list', or 'array'. The flat value for the
* 'format' argument will separate tags with spaces. The list value for the
* 'format' argument will format the tags in a UL HTML list. The array value for
- * the 'format' argument will return in PHP array type format.
+ * the 'format' argument will return in PHP array type format. The array value
+ * for the 'object' argument will return an array of objects with unformated
+ * data.
*
* The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
* The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.
@@ -547,7 +549,7 @@
$return = apply_filters( 'wp_tag_cloud', $return, $args );
- if ( 'array' == $args['format'] || empty($args['echo']) )
+ if ( 'array' == $args['format'] || 'object' == $args['format'] || empty($args['echo']) )
return $return;
echo $return;
@@ -581,7 +583,9 @@
* argument can be 'flat' (default), 'list', or 'array'. The flat value for the
* 'format' argument will separate tags with spaces. The list value for the
* 'format' argument will format the tags in a UL HTML list. The array value for
- * the 'format' argument will return in PHP array type format.
+ * the 'format' argument will return in PHP array type format. The array value
+ * for the 'object' argument will return an array of objects with unformated
+ * data.
*
* The 'tag_cloud_sort' filter allows you to override the sorting.
* Passed to the filter: $tags array and $args array, has to return the $tags array
@@ -671,13 +675,29 @@
$tag_link = '#' != $tag->link ? esc_url( $tag->link ) : '#';
$tag_id = isset($tags[ $key ]->id) ? $tags[ $key ]->id : $key;
$tag_name = $tags[ $key ]->name;
- $a[] = "$tag_name";
+
+ if ($format == 'object')
+ {
+ $tag_record = new stdClass;
+ $tag_record->id = $tag_id;
+ $tag_record->url = $tag_link;
+ $tag_record->name = $tag_name;
+ $tag_record->slug = $tags[$key]->slug;
+ $tag_record->real_count = $real_count;
+ $tag_record->class = 'tag-link-'.$tag_id;
+ $tag_record->size = $smallest + ($count - $min_count);
+ $tag_record->font_size = ($smallest + (($count - $min_count) * $font_step));
+ $a[] = $tag_record;
+ } else {
+ $a[] = "$tag_name";
+ }
}
switch ( $format ) :
case 'array' :
+ case 'object' :
$return =& $a;
break;
case 'list' :