WordPress.org

Support

Support » Requests and Feedback » list properties for wp_tag_cloud()

list properties for wp_tag_cloud()

  • Hi,

    for a while, I’ve been using the Simple-Tagging plugin, but since it is no more compatible with 2.3+ versions of WordPress, and because I prefer not using a lot of plugins, I switched to WordPress-Tags. Migration was flawless thanks to the “import” function of the console. I found everything I needed, from the_tags() to wp_tag_cloud(). But there was this tiny advantage with Simple-Tagging that every tag was included in a list that has a class matching the number of links associated. This permits to write CSS properties and have different colors relative to the tag’s importance. I wrote a very simple plugin to handle this, but would this be a major breakout to handle this directly in the wp_generate_tag_cloud() function, in the case 'list' part ?
    For my own needs, I defined that there’s 10 levels of colors, so the code looks like this (beware, i’m really not a PHP programmer) :

    // $fact contains the number of links in a tag
    $fact = $fact % 5;
    if (++$fact > 10) { $fact = 10; }
    ?><li class=”< ?php echo "t$fact"; ?>“>< ?php
    echo "$tag\n";

    To make it more usable, we can think of having one or two additional parameters to wp_generate_tag_cloud(), like “color_limit” and “color_stepping”.

    Maybe that feature was already on the pipe and this post is totally clueless, if it is the case, please forgive me 🙂

    My 2c

  • The topic ‘list properties for wp_tag_cloud()’ is closed to new replies.
Skip to toolbar