From 46caaba88b3bfee02824478960183abccd7427ab Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 21 Feb 2010 02:47:58 +0000 Subject: [PATCH] Allow the Tag Cloud Widget to support non-tag taxonomies. Props Sivel. Fixes #11612 git-svn-id: https://develop.svn.wordpress.org/trunk@13276 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/default-widgets.php | 35 ++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index f6f8f3289b..bf14a8fc49 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -976,27 +976,56 @@ class WP_Widget_Tag_Cloud extends WP_Widget { function widget( $args, $instance ) { extract($args); - $title = apply_filters('widget_title', empty($instance['title']) ? __('Tags') : $instance['title'], $instance, $this->id_base); + $current_taxonomy = $this->_get_current_taxonomy($instance); + if ( !empty($instance['title']) ) { + $title = $instance['title']; + } else { + if ( 'post_tag' == $current_taxonomy ) { + $title = __('Tags'); + } else { + $tax = get_taxonomy($current_taxonomy); + $title = $tax->label; + } + } + $title = apply_filters('widget_title', $title, $instance, $this->id_base); echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; echo '
'; - wp_tag_cloud(apply_filters('widget_tag_cloud_args', array())); + wp_tag_cloud( apply_filters('widget_tag_cloud_args', array('taxonomy' => $current_taxonomy) ) ); echo "
\n"; echo $after_widget; } function update( $new_instance, $old_instance ) { $instance['title'] = strip_tags(stripslashes($new_instance['title'])); + $instance['taxonomy'] = stripslashes($new_instance['taxonomy']); return $instance; } function form( $instance ) { + $current_taxonomy = $this->_get_current_taxonomy($instance); ?>

- +