Change the amount of tags in tagcloud in WordPress

Add this piece of code to your theme’s function.php file.

add_filter('widget_tag_cloud_args','set_number_tags');
function set_number_tags($args) {
    $args = array('number'    => 20);
    return $args;
}

 Set the number of the amount of tags you want to display on your page.

Or you can just use the parameters for the wp_tag_cloud function.

<?php $args = array(
    'smallest'                  => 8, 
    'largest'                   => 22,
    'unit'                      => 'pt', 
    'number'                    => 45,  
    'format'                    => 'flat',
    'separator'                 => \"n\",
    'orderby'                   => 'name', 
    'order'                     => 'ASC',
    'exclude'                   => null, 
    'include'                   => null, 
    'topic_count_text_callback' => default_topic_count_text,
    'link'                      => 'view', 
    'taxonomy'                  => 'post_tag', 
    'echo'                      => true,
        'child_of'                   => null(see Note!)
); ?>
 <?php wp_tag_cloud( $args ); ?>

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s