Show Tag Cloud as unordered list

  • Anonymous

    #2942

    I know this one is weird as the purpose of the tag cloud is to differentiate the tags based on size which is based on usage BUT when the site is just starting all of the tags are the same size and they are just an ugly list of words.

    Can I set a parameter that returns an unordered or ordered list instead of the present format? I see in the codex that there is a parameter of ‘format’ with an option of ‘list’ but I haven’t found where that might be modified within Graphene.

    As always thanks for your help.

    Prasanna SP

    #22786

    Just use the same font for both smallest and largest fonts. Here is an example. This should go in child theme’s functions.php file. (Untested, but should work.)

    function samefont_tag_cloud($args) {
    $args['largest'] = 12; //largest tag font size
    $args['smallest'] = 12; //smallest tag font size
    return $args;
    }
    add_filter( 'widget_tag_cloud_args', 'samefont_tag_cloud' );

    This will return a flat tag could with all the tags of the same font size. If you want unordered list, add $args['format'] = 'list'; to the args

    function samefont_ul_tag_cloud($args) {
    $args['largest'] = 12; //largest tag font size
    $args['smallest'] = 12; //smallest tag font size
    $args['format'] = 'list'; //unordered list
    return $args;
    }
    add_filter( 'widget_tag_cloud_args', 'samefont_ul_tag_cloud' );

    Craig

    #22787

    Thanks Prasanna. Actually I have been a bad boy and making changes through the custom css so when you wanted to add to functions.php I bit the bullet and created a child-theme (I’ve matured to that point with six Graphene installations so I should do it the right way.)

    At any rate I’ve created child theme, activated it, added functions.php and added your code (with the prerequisite <?php and ?>) but it doesn’t seem to create the UL. Any ideas? You can see the page at http://www.tracydunndesign.com/tracys-blog/. Thanks.

    Prasanna SP

    #22788

    Did you try the second code I’ve given here?

    i.e adding $args['format'] = 'list';

    Current font sizes but, unordered list,

    function samefont_ul_tag_cloud($args) {
    $args['format'] = 'list'; //unordered list
    return $args;
    }
    add_filter( 'widget_tag_cloud_args', 'samefont_ul_tag_cloud' );

    All tags of same font size and unordered list,

    function samefont_ul_tag_cloud($args) {
    $args['largest'] = 12; //largest tag font size
    $args['smallest'] = 12; //smallest tag font size
    $args['format'] = 'list'; //unordered list
    return $args;
    }
    add_filter( 'widget_tag_cloud_args', 'samefont_ul_tag_cloud' );

    Craig

    #22789

    Yes. It was your second batch of code that I put in functions.php. Since this is the first time I’ve created functions.php let me include the code so you can see. Maybe some structure is incorrect. Thanks.

    <?php
    function samefont_ul_tag_cloud($args) {
    $args['largest'] = 12; //largest tag font size
    $args['smallest'] = 12; //smallest tag font size
    $args['format'] = 'list'; //unordered list
    return $args;
    }
    add_filter( 'widget_tag_cloud_args', 'samefont_ul_tag_cloud' );

    ?>

    Prasanna SP

    #22790

    Hmmm.. Are you using any caching plugin?

    I can fix it for you if you give me the temporary access to your admin area.

    Else, I can write a plugin for that. But, it takes some time.. I’m busy now..

    Craig

    #22791

    I have no problem granting you access. How should we do it? I’m craig@kamamarketing.com

    Prasanna SP

    #22792

    Use my contact form to send me the login credentials – http://www.prasannasp.net/contact/

    It’s too late here. I’m gonna sleep now. So, I’ll look at your site tomorrow.

    Prasanna SP

    #22793

    Wow! There is already a plugin called “Configurable Tag Cloud (CTC)”. Try it – http://wordpress.org/extend/plugins/configurable-tag-cloud-widget/

    It has an option to set format as “list”

    http://wordpress.org/extend/plugins/configurable-tag-cloud-widget/

    Craig

    #22794

    I’ve loaded it but it isn’t working so I’m taking a look at some of the code and install and see. If your php code didn’t work and his plugin didn’t work then the problem sort of points to me. I’ll look and if I can’t get it to work I’ll send you the login info.

    FYI while I’m trying to get the plugin working I’ve taken down the function.php file to make sure they weren’t in conflict of each other. I’ll check in again.

Viewing 10 posts - 1 through 10 (of 12 total)

You must be logged in to reply to this topic.