• Hey,

    I’m currently using

    <h3>Tags</h3>
    <?php wp_tag_cloud('largest=48'); ?>

    I was wondering how I can apply “largest=48” via Functions.php to all calls of the tag-cloud on the sidebar?

    Something like:

    FUNCTION if: tag_cloud add: 'largest=48'

    Lou

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter Lou Sparx

    (@roulettered)

    Does anyone have any ideas? any code gurus out there?

    (edit: this might reset all other parameters to default)

    for the default cloud widget:

    add_filter('widget_tag_cloud_args','set_largest_tags');
    function set_largest_tags($args) {
    $args = array('largest'    => 48);
    return $args;
    }

    edit 2: you can add multiple parameter into the array.
    https://codex.www.ads-software.com/Plugin_API/Filter_Reference

    Thread Starter Lou Sparx

    (@roulettered)

    “this might reset all other parameters to default”

    Is this a bad thing? you mention “all other parameters” are you referring to just the tag-cloud parameters?

    Thread Starter Lou Sparx

    (@roulettered)

    Either way, this got the job done ??

    Thanks so much, alchymyth.

    Lou

    well done ??

    Is this a bad thing? you mention “all other parameters” are you referring to just the tag-cloud parameters?

    this is just referring to the tag cloud parameters; however, the good thing is that you can set as many parameters as you need to change.

    This code works equally well to limit the number of tags displayed in the cloud with only minor changes:

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

    Thanks, alchymyth

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Customize Tag-Cloud via Functions’ is closed to new replies.