Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter polomasta

    (@polomasta)

    why is it that you always figure it out after you ask the question?

    Here are my modifications to widgets.php if anyone else would like this functionality. It gives you the ability to set the number of tags you want to include in the tag cloud.

    function wp_widget_tag_cloud($args) {
    	extract($args);
    	$options = get_option('widget_tag_cloud');
    	$title = empty($options['title']) ? __('Tags') : $options['title'];
    	$number = empty($options['number']) ? __('Tags') : $options['number'];
    
    	echo $before_widget;
    	echo $before_title . $title . $after_title;
    	wp_tag_cloud('number='.$number.'');
    	echo $after_widget;
    }
    
    function wp_widget_tag_cloud_control() {
    	$options = $newoptions = get_option('widget_tag_cloud');
    
    	if ( $_POST['tag-cloud-submit'] ) {
    		$newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title']));
    		$newoptions['number'] = $_POST['tag-cloud-number'];
    
    	}
    
    	if ( $options != $newoptions ) {
    		$options = $newoptions;
    		update_option('widget_tag_cloud', $options);
    	}
    
    	$title = attribute_escape( $options['title'] );
    	$number = attribute_escape( $options['number'] )
    ?>
    	<label for="tag-cloud-title">
    	<?php _e('Title:') ?> <input type="text" class="widefat" id="tag-cloud-title" name="tag-cloud-title" value="<?php echo $title ?>" /></label>
    
    	<label for="tag-cloud-number">
    	<?php _e('Number of Tags to Display:') ?> <input type="text" class="widefat" id="tag-cloud-number" name="tag-cloud-number" value="<?php echo $number ?>" /></label>
    
    	<input type="hidden" name="tag-cloud-submit" id="tag-cloud-submit" value="1" />
Viewing 1 replies (of 1 total)