Tweeted twitter.com/#!/StackWordPress/status/491924831445999616
3 Title grammar correction
| link

edit Edit tag cloud widget number

2 added 3 characters in body; deleted 4 characters in body; added 11 characters in body
source | link

By default, the WordPress tag cloud widget has a set amount of 45 tags to display. This can be seen in the wp-includes.php/category-template.php file.

By default, the WooCommerce plugin which I have installed, and it's products tag cloud widget also resembles this.

How do I modify this amount from within my themes wp-content/themes/functions.php file, to display for example, only 15 product tags?

Here is what I have so far, but it is not working.

function custom_tag_cloud_widget($args) {
    $args['smallest'] = 8; //smallest tag
    $args['largest'] = 22; //largest tag
    $args['number'] = 15; //adding a 0 will display all tags
    $args['unit'] = 'pt'; //tag font unit
    return $args;
}

add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

When changing the number within the core wp-includes.php/category-template.php file to 15 however, it does work.

Obviously, I don't wish to edit any core files and am looking for an alternative solution.

Thanks.

By default, the WordPress tag cloud widget has a set amount 45 tags to display. This can be seen in the wp-includes.php/category-template.php file.

By default, the WooCommerce plugin which I have installed, and it's products tag cloud widget also resembles this.

How do I modify this amount from within my themes functions.php file, to display for example, only 15 product tags?

Here is what I have so far, but it is not working.

function custom_tag_cloud_widget($args) {
    $args['smallest'] = 8; //smallest tag
    $args['largest'] = 22; //largest tag
    $args['number'] = 15; //adding a 0 will display all tags
    $args['unit'] = 'pt'; //tag font unit
    return $args;
}

add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

Thanks.

By default, the WordPress tag cloud widget has a set amount of 45 tags to display. This can be seen in the wp-includes/category-template.php file.

By default, the WooCommerce plugin which I have installed, and it's products tag cloud widget also resembles this.

How do I modify this amount from within my wp-content/themes/functions.php file, to display for example, only 15 product tags?

Here is what I have so far, but it is not working.

function custom_tag_cloud_widget($args) {
    $args['smallest'] = 8; //smallest tag
    $args['largest'] = 22; //largest tag
    $args['number'] = 15; //adding a 0 will display all tags
    $args['unit'] = 'pt'; //tag font unit
    return $args;
}

add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

When changing the number within the core wp-includes.php/category-template.php file to 15 however, it does work.

Obviously, I don't wish to edit any core files and am looking for an alternative solution.

Thanks.

1
source | link

edit tag cloud widget number

By default, the WordPress tag cloud widget has a set amount 45 tags to display. This can be seen in the wp-includes.php/category-template.php file.

By default, the WooCommerce plugin which I have installed, and it's products tag cloud widget also resembles this.

How do I modify this amount from within my themes functions.php file, to display for example, only 15 product tags?

Here is what I have so far, but it is not working.

function custom_tag_cloud_widget($args) {
    $args['smallest'] = 8; //smallest tag
    $args['largest'] = 22; //largest tag
    $args['number'] = 15; //adding a 0 will display all tags
    $args['unit'] = 'pt'; //tag font unit
    return $args;
}

add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );

Thanks.