The 2.3 tag cloud widget only has an option for Title. Would like to see all options that are available to the wp_tag_cloud function made available to the widget as well.
The 2.3 tag cloud widget only has an option for Title. Would like to see all options that are available to the wp_tag_cloud function made available to the widget as well.
Strongly agree! I just spent the last hour and a half tracing through the code to remove the bleeping nbsp's from the tags -- that's not an option that can be specified, no, but it did give me a great intro to the rest of the tagging system. It wouldn't be too difficult to add more fields for minimum size, maximum size, maximum number, etc.
Totally necesary!!!
An option to pass dates to the tag cloud function, so it only displays tags within a certain date span would also be nice :)
Here is a patch for the tag cloud widget, giving it an option to show all tags. Is there a better way to submit patches?
Thanks,
Rick
--- wp-includes/category-template.php~ 2009-08-27 20:22:30.000000000 -0400
+++ wp-includes/category-template.php 2009-12-08 04:44:05.005340340 -0500
@@ -520,12 +520,15 @@
* @param array|string $args Optional. Override default arguments.
* @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
*/
-function wp_tag_cloud( $args = '' ) {
+function wp_tag_cloud( $args = '', $sall ) {
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
);
+ if ( $sall != 0)
+ $args['number'] = 0;
+
$args = wp_parse_args( $args, $defaults );
$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
----------------------------
--- wp-includes/default-widgets.php.org 2009-12-07 13:56:53.352340238 -0500
+++ wp-includes/default-widgets.php 2009-12-08 04:21:02.103340190 -0500
@@ -968,16 +968,19 @@
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title']);
+ $sall = empty($instance['showall']) ? 0 : $instance['showall'];
+
echo $before_widget;
if ( $title )
echo $before_title . $title . $after_title;
echo '<div>';
- wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()));
+ wp_tag_cloud(apply_filters('widget_tag_cloud_args', array()), $sall);
echo "</div>\n";
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
+ $instance['showall'] = isset($new_instance['showall']) ? 1:0 ;
$instance['title'] = strip_tags(stripslashes($new_instance['title']));
return $instance;
}
@@ -986,6 +989,13 @@
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p>
+
+
+ <input class="checkbox" type="checkbox" <?php checked($instance['showall'], true) ?> id="<?php echo $this->get_field_id('showall'); ?>" name="<?php echo $this->get_field_name('showall'); ?>" />
+ <label for="<?php echo $this->get_field_id('showall'); ?>"><?php _e('Show All Tags'); ?></label>
+
+
+
<?php
}
}
Moving right along, now we have ticket #11357 !
Thanks
Rick
Best thing to do would be to write a plugin that replaces the existing Tag Cloud widget with a new widget that exposes all options.
If there is still interest, I will write such a plugin. Let me know.
There are quite a few plugins (including my own: http://www.wordpress.org/extend/plugins/most-popular-tags ) that implement most of the functionality that wp_tag_cloud() offers.
This topic has been closed to new replies.