Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How to alter the default widget to display a tag cloud of a custom taxonomy?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Don't know of any but you can easily create your own:

<?php 
add_action("widgets_init", array('Widget_Custom_tax_tag_cloud', 'register'));
class Widget_Custom_tax_tag_cloud {
    function control(){
        echo 'No control panel';
    }
    function widget($args){
        echo $args['before_widget'];
        echo $args['before_title'] . 'Your widget title' . $args['after_title'];
        $cloud_args = array('taxonomy' => 'Your taxonomy here');
        wp_tag_cloud( $cloud_args ); 
        echo $args['after_widget'];
    }
    function register(){
        register_sidebar_widget('Widget name', array('Widget_Custom_tax_tag_cloud', 'widget'));
        register_widget_control('Widget name', array('Widget_Custom_tax_tag_cloud', 'control'));
    }
}
?>

just change : 'Your widget title' with your title and Your 'taxonomy here' with the name of your taxonomy.

you can change the look and feel by passing more arguments in the $cloud_args from the large list in the codex

Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.