gtiphane
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Fixing WordPress
In reply to: Limit # of Tags in Widget tag cloudall right, I took a chance and added smallest and largest as parameters for the tag cloud widget options. It seems to work on my site, but I’m not really a developer (or want to be one?). Here are the functions in widgets.php, I don’t know if someone could check the code again and use it.
function wp_widget_tag_cloud($args) { extract($args); $options = get_option('widget_tag_cloud'); $title = empty($options['title']) ? __('Tags') : $options['title']; $smallest = empty($options['smallest']) ? __('8') : $options['smallest']; $largest = empty($options['largest']) ? __('22') : $options['largest']; $number = empty($options['number']) ? __('45') : $options['number']; echo $before_widget; echo $before_title . $title . $after_title; wp_tag_cloud('smallest='.$smallest.'&largest='.$largest.'&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['smallest'] = $_POST['tag-cloud-smallest']; $newoptions['largest'] = $_POST['tag-cloud-largest']; $newoptions['number'] = $_POST['tag-cloud-number']; } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_tag_cloud', $options); } $title = attribute_escape( $options['title'] ); $smallest = attribute_escape( $options['smallest'] ); $largest = attribute_escape( $options['largest'] ); $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-smallest"> <?php _e('Smallest Point Size:') ?> <input type="text" class="widefat" id="tag-cloud-smallest" name="tag-cloud-smallest" value="<?php echo $smallest ?>" /></label> <label for="tag-cloud-largest"> <?php _e('Largest Point Size:') ?> <input type="text" class="widefat" id="tag-cloud-largest" name="tag-cloud-largest" value="<?php echo $largest ?>" /></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" /> <?php }
Forum: Fixing WordPress
In reply to: Limit # of Tags in Widget tag cloudI was wondering if line 5 shouldn’t read
$number = empty($options[‘number’]) ? __(’45’) : $options[‘number’];
instead of
$number = empty($options[‘number’]) ? __(‘Tags’) : $options[‘number’];
I’d like to add options for smallest and largest font sizes because the default is too large for my cloud. Let me know if the above makes sense to you.
Viewing 2 replies - 1 through 2 (of 2 total)