WordPress Configurable Tag Cloud Plugin

This plugin is no longer under active development.

NEW! Version 5.2 released. See below for changelog/notes.

Frustrated by the built-in tag cloud widget in WordPress 2.3? I was. So I wrote my own that not only gives you configuration options (which are sorely needed), you also get font and color control of the generated links.

Download: Configurable Tag Cloud Plugin
Mirror: CTC at WP Extend

Translations:
CTC Version 4.1 (Hebrew Translation) – Hebrew translation by Meir Pinto.

Plugin Notes:
Changelog:

ver. 5.2 – Released November 13, 2009
Changes:

  • Fix: Moved plugin files out of folder so WP Extend plugin update system can be used.
  • Fix: Got rid of PHP short tags.
  • Change: Added default class to cloud link elements. Class name is “ctc-tag”. Thanks to Raafi Rivero (desedo.com) for bug report and link class suggestion.

ver. 5.1 – Released August 2nd, 2009
Changes:

  • Fix: Fixed issue with default options not being set on plugin activation.

ver. 5.0 – Released July 31st, 2009
Changes:

  • Change: Modularized plugin to better handle troubleshooting issues.
  • Change: Widget upgraded to new Widget API. Retained backwards-compatibility with older versions of WordPress.
  • Change: Widget is now fully multi-widget compliant. You can now have multiple cloud widgets active with different settings for each.
  • Change: Added support for limiting cloud by number of posts in each tag. Both an upper and lower limit are supported. Defaults for limits are 0 (lower) and 100 (upper).
  • Change: Can now choose to not show tags (i.e., to show a category cloud).
  • Change: Added “dropdown” cloud format. Thanks to Scott Bradford of Scott Bradford Creative Enterprises for the change.

ver. 4.5 – Released April 18th, 2008
Changes:

  • Added option menu for configuring the plugin when using the template tag. Options set via the control panel can be over-ridden using parameters in the tag. Widget and non-widget options are separate, giving you the ability to have multiple clouds with different options.
  • Removed limit for number of tags returned by default. The plugin will now show ALL tags in your blog unless you specify a limit.
  • Removed “Array” cloud format from widget control panel. More processing needs to be done to the array after creation in order to display, and you can’t do that when using as a widget. This was causing confusion, so it was removed.

ver. 4.1 – Released February 22nd, 2008
Changes:

  • Added random sort feature for cloud
  • Fixed error resulting in links for categories in the cloud not being generated correctly.

ver. 4.0 – Released February 15th, 2008
Changes:

  • Added support for categories in the cloud. You can choose whether or not to show categories in the cloud, and whether to show empty categories.
  • Not assigning any colors in the widget control panel or the template tag will now make the cloud links use the defined CSS link color. If only one color is supplied, your links will be that color.

ver. 3.2 – Released February 12th, 2008
Changes:

  • Fixed problem with spaces after tags being underlined if using the “text-decoration: underline” style in your stylesheet.

ver. 3.1 – Released February 6th, 2008
Changes:

  • Added option to use array for cloud format (see below for example)

ver. 3.0 – Released December 2nd, 2007
Changes:

  • Can now be used without widgets (see below for more info)
  • Added option to display post count after tags

ver. 2.51 – Released October 19th, 2007
Changes:

  • Fixed bug that prevented tag count option from working correctly. It came down to a bad variable name.

ver. 2.5 – Released October 16th, 2007
Changes:

  • Added div surrounding tag cloud for styling purposes.
  • Fixed bug that would produce “Divide by zero” errors on display if you didn’t input anything for smallest and/or largest font size in config form.

ver. 2.0 – Released October 3rd, 2007
Changes:

  • Added code necessary to enable coloring tag links by weight.
  • Changed from using WordPress-native tag cloud function to internal widget function to generate tag cloud (required for color).
  • Removed “array” format. I’m not sure it would be of any use running in a widget, but if you need it, the call to add it to the dropdown can be found commented out at line 217 in tag-cloud.php.
  • Added brief help text to the right of each field in the form.

ver. 1.0 – Initial Release, September 22, 2007
Initial release of widget. Relied on the built-in WordPress tag cloud function.

CTC 4.0 config screenshot

Installation:
Upload the tag_cloud folder to your wp-content/plugins directory, and activate via the Plugins admin panel.

Upgrades:
I recommend using the automated plugin upgrade features in WordPress, but to upgrrade manually, disable plugin in Admin panel. Delete tag-cloud.php, upload the new tag_cloud folder, and enable in admin panel.

Use:
Widget Defaults:

TitleTags
Number of Tags to Showall
Minimum number of posts for a tag or category to show in the cloud0
Maximum number of posts for a tag or category to show in the cloud100
Number of Tags to Display45
Font Display UnitPoints
Smallest Font Size8
Largest Font Size22
Min. Tag Colornone (see note below)
Max. Tag Colornone (see note below)
Cloud FormatFlat
Categories in cloud?No
Show empty?No
Display Post Count?No
Sort ByName
Sort OrderAscending

After installing/upgrading, enable the widget via the Plugins tab. This will give you a new button in the Widgets control panel labeled “CTC” (Configurable Tag Cloud was too long for the button). Drag it into your sidebar list, and configure the options to your liking. If you want to keep the defaults for the widget, just leave everything as-is.

The widget gives you the capability to modify almost all of the settings of the wp_tag_cloud() template tag. At this point, you can do everything but exclude tags from the cloud display. I’m still working on this, but at this point, all the options most users would want are represented.

Notes about limiting the tags that are shown in the cloud (New in 5.0): You can now choose to limit the tags shown in the cloud by the number of posts they are attached to. For example, say you have one or two tags that are attached to 20 posts, but the rest only have one or two posts. Previously, these tags would be large, with the rest fairly small. Now, you can tell the plugin that you want to exclude tags that have more than 10 posts, and those tags will be excluded from the cloud, with the rest following a (hopefully) smoother gradient in both color and size. This also works for tags with fewer than a specified number of posts. The defaults as defined in the plugin are a maximum of 100 and a minimum of 0.

Notes about color (new in 2.0, updated in 4.0): If left blank, the tag cloud link colors will default to your assigned CSS color from the stylesheet. If you use one color (either min or max, doesn’t matter) only, your tag cloud links will be displayed using that color.

Notes about styling the tag cloud (new in 2.5, updated in 4.0): The div surrounding the tag cloud has it’s class set as “ctc”. You should be able to modify any property of this class via CSS except for font-size (this is set with inline styles in the links themselves). Tag link color can now be controlled via the stylesheet by leaving both the min and max colors blank in the configuration and setting a color in your stylesheet.

Notes about non-widget use (new in 3.0): Just like the widget, this function replaces the built-in wp_tag_cloud function with options for color, font size, etc. The function uses the standard query string format for arguments.

To use, simply insert the function call into your template file (most likely sidebar.php, but you can put it wherever you like), and adjust the options accordingly.

Example

<?php ctc('smallest=10&largest=28&unit=px&mincolor=#c0c0c0&maxcolor=#000000&showcount=yes'); ?>

This would show a cloud with font sizes from 10 to 28 pixels, a color gradient of #c0c0c0 to #000000, and post counts after each tag.

Notes about array use (new in 3.1): I’m still undecided on why you would want to use an array, but it was requested, so it has been added. You call the function via the template tag just as you would for non-array use, but assigning the output to a variable. I’ll give you an example.

<?php
$tags = ctc('format=array&smallest=10&largest=28&unit=px&mincolor=#c0c0c0&maxcolor=#000000&showcount=yes');
foreach ($tags as $tag) {
echo $tag."\n"
}
?>

This would show a cloud just like the first example, but using an array to output it to the page.

CTC Ver. 4.5 Options Screen

Parameters for template tag:

PARAMETERFUNCTIONDEFAULT VALUE
smallest=#Smallest font size to use8
largest=#Largest font size to use22
minnum=#Minimum number of posts for a tag or category to show in the cloud0
maxnum=#Maximum number of posts for a tag or category to show in the cloud100
unit=pt|em|%|pxUnit for font sizept
mincolor=#xxxxxxLow color for gradientnone
maxcolor=#xxxxxxHigh color for gradientnone
format=flat|list|array|dropFormat for tag cloudflat
number=#Number of tags to show45
orderby=name|count|randSort field for tagsname
order=ASC|DESCOrder of cloudASC
showcount=yes|noShow post count after tagsno
showcats=yes|noShow categories in cloudno
empty=yes|noShow empty categoriesno

Troubleshooting:
If for some reason you run into trouble, please don’t hesitate to email me or post a comment on this page.

263 thoughts on “WordPress Configurable Tag Cloud Plugin”

  1. I'm using a theme by Woo Themes, whose gurus seem to recommend this plug-in. I'm using v3.0 WP.

    Here's what happens. It installs, I enter my preferred styling, then – nothing. The whole tags widget is gone, nothing showing at all. I've tried installing it via the theme options (in zip upload) and I've also tried installing the folder into my wp/content/plugins folder – this way, it doesn't even show in the list of plug-ins on my dashboard!

    Is it broken on 3.0? Such a pity – it looks like one of the few options that enable you to style the tag cloud adequately, but it doesn't work here for me 🙁

  2. Hi, first of all I would like to say that this plugin is awesome, so thanks for creating it 🙂 I was wondering if it is possible to filter tags only from one category. I.e. in my case I have a custom page that only shows posts from category 1 and I would like the tags only to be from posts in that category. Is that possible ?

  3. We're using your CTC plugin on our site, finding it very useful, and would like to make a monetary donation. I don't see a donate button here anywhere. How can I contribute?

    Thanks…

    …Bill

  4. After installing the tag cloud in left sidebar I filled in the choices.
    In my own Fireox the are there and visible. In Internet Explorer they are invisible. Only the Title: Tags On Weblog RCS is visible but the 400 tags nowhere tobe seen.
    Some other peoples also complain that the can't see them others do see them. It doesn't matter which browser they use….

  5. hi, thanks for the plugin, I’ve been using it at least a couple of years, but I would really appreciate the addition of an exclude option, as promised way up there and long ago.

    If there’s some arcane technical reason why this cannot be done, would you mind letting us know?

    I’d be tempted to dive in and hack the plugin myself, but I’d only do something hilarious…

  6. I'm new to wordpress, and don't know too much about this. And I think this was working when I installed it a few months ago….anyhow I'm curious why this doesn't appear as a cloud, but instead as a list. In the CTC settings there is Flat, List, Dropdown, and array. No matter what I choose, its always a list. I run the latest wordpress. I'm assuming that the individual widget settings under Appearance – widgets, is overriding the general settings. I notice in that area only Flat, List, and Dropdown are available. Array is missing.

  7. got an errot trying to drop this is into a 3.0 test mu site

    Fatal error: Cannot redeclare colorweight() (previously declared in E:Inetpub_Prodmyblogsdevwp-contentmu-pluginsMuTags.php:950) in E:Inetpub_Prodmyblogsdevwp-contentpluginsconfigurable-tag-cloud-widgetbase.php on line 62

    Mutugs is a plugin that provides a global tag cloud for the whole site it has been a round a while and I am not surte how well it is supported

    Paul

  8. Sorry about the broken download link folks…the plugin I use to manage downloads issued an update that caused a few issues. It has been rectified now, but I'll be adding a link to the plugin listing at WP Extend so if this happens in the future, it shouldn't be so hard to get the plugin.

    Again, sorry for the confusion.

    1. never mind, I looked at the directions, and now it is beautiful, I like it very much, awesome job 🙂
      I forgot to drag the CTC widget to my widgets on the right… sorry about that bad comment…

  9. Terrific plugin, Keith. I'm using it (with credit on my 'about' page) on my site.
    A feature that would be very cool would be if the tags' LINK colors could also be user defined. (A color gradient like the COLOR property would be sweet!)

  10. Great plugin! I have been using it for several months now and I love it. I have however, run into a problem. I now have over 60 tags but only 45 show up on the new post submission page and on the "Post Tags" page in my blog's admin section. All tags do show up on my blog but when posting a new post, I have only 45 tags to select from. Does anyone know how I might fix this? Is there an actual help forum someplace? ~ Thank you!!!

  11. Hello, Thanks for the plugin, one issue I am having is it seems that it is not following the maxnum rule for categories. What do I need to change so it categories will follow? Thanks!

    1. Same problem as Jared.

      I'm testing this with minnum and maxnum with showcats set to "yes". minnum and maxnum doesn't appear to work when categories are enabled.

      1. Okay this was an easy fix.

        Change the whole *if ('yes' == $showcats) {* block to:

        if ('yes' == $showcats) {
        // Do they want to see empty categories?
        if ('yes' == $empty) {
        $empty=0;
        } else {
        $empty=1;
        }

        $hide_empty = '&hide_empty='.$empty;

        $cats = get_categories("show_count=1&use_desc_for_title=0&hierarchical=0$hide_empty");

        $filteredCats = array();

        foreach ($cats as $cat) {
        if ($cat->count < $minnum || $cat->count > $maxnum)
        continue;

        array_push($filteredCats, $cat);
        }

        $tagscats = array_merge($tags, $filteredCats);

  12. runner a newer version of wp (2.8+) and have a ton of catergories/posts, but activating ctc, and adding it to the widgets shows nothing – the code is there (in firebug) but the ctc div is empty

  13. Hello!

    Thank for a beautiful plugin! Very very useful!

    One question: can I add tags like a single line to my template? instead of pagelist (in my case). Code in template (header.php) here:

    <div id="navpages">
    <ul id="navpagelist">
    <?php wp_list_pages('sort_column=menu_order&title_li=&exclude='.$npdv_options["excludePageNav"]); ?>
    <div class="clear"></div>
    </div>

    Thank you!

  14. Hi there,

    do you think another feature could be to remove the "internal" link? I want to use the tag-cloud for additional content with havin so much internal links on my blog.

    Thanks Joachim

  15. Widget Title in different languages: Could you please give me a hint where to look for the string of the widget title? I'd like to add some code from qTranslate to switch the language of the title between german and italian.

  16. First off, sorry for taking so long to post back…between having a 6 month old, and work, I've been swamped! 🙂

    I'm not sure why you guys are seeing the errors on activation. I have downloaded the plugin from both here and from WP Extend and both work fine. If you're having issues, I'd recommend deleting the plugin from your plugins folder and try installing it again either from a download or via the Plugin Search function, both work equally well).

  17. Hi Keith. I've just downloaded version 5.0 today. (last one available, right? Because somoene here said he downloaded the 5.2 ?? Where is it? ) But I get this error when trying to activate the plugin:____Warning: require(/home/domain/public_html/wp-content/plugins/base.php) [function.require]: failed to open stream: No such file or directory in /home/domain/public_html/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16____I've read something you said about downloading manually the plugin? How do I do that? Look please. What I did was, first, download the ZIP to my computer. Second, uploaded it to my site via CPanel. Once there, ( and using CPanel) I extracted files into a new folder I called "tag cloud" . Once extracted, I put the folder "configurable-tag-cloud-widget" I've got from extraction, in the "/public_html/wp-content/plugins" directory. Last, I went to "manage plugins" in WP, found the plugin there and tried to activate it. That's all. Now, is this procedure what you call "manual download"? If not, please tell me how I do it. ____Thanks!__Cristian

  18. I just downloaded 5.2 from here and extracted it into my plugins directory. Activation threw the following fatal error. Switching back to 5.1.

    Warning: require() [function.require]: Unable to access /f5/abrokenmold/public/wp-content/plugins/base.php in /f5/abrokenmold/public/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    Warning: require(/f5/abrokenmold/public/wp-content/plugins/base.php) [function.require]: failed to open stream: No such file or directory in /f5/abrokenmold/public/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    Warning: require() [function.require]: Unable to access /f5/abrokenmold/public/wp-content/plugins/base.php in /f5/abrokenmold/public/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    Warning: require(/f5/abrokenmold/public/wp-content/plugins/base.php) [function.require]: failed to open stream: No such file or directory in /f5/abrokenmold/public/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    Fatal error: require() [function.require]: Failed opening required '/f5/abrokenmold/public/wp-content/plugins/base.php' (include_path='.:/nfsn/apps/php5/lib/php/:/nfsn/apps/php/lib/php/') in /f5/abrokenmold/public/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

  19. what's going on with Version: 5.2?

    Warning: require(/home/pengkuny/domains/niaolei.org.cn/public_html/wp-content/plugins/base.php) [function.require]: failed to open stream: No such file or directory in /home/pengkuny/domains/niaolei.org.cn/public_html/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    Fatal error: require() [function.require]: Failed opening required '/home/pengkuny/domains/niaolei.org.cn/public_html/wp-content/plugins/base.php' (include_path='.:/usr/local/lib/php') in /home/pengkuny/domains/niaolei.org.cn/public_html/wp-content/plugins/configurable-tag-cloud-widget/tag_cloud.php on line 16

    1. This has been addressed (it was a stupid error on my part caused by not enough coffee 🙂 ), however, you'll need to manually download the plugin in order to resolve it. I forgot to change the location of the required files in the code, so it threw an error when you tried to activate it.

  20. Great Plugin! I'm looking to add a little more. First off, I will say, I know very little about coding, etc. This plugin does 1/2 of what I'm looking for exactly. On my website, each tag is associated with a thumbnail. I found another great plugin, Tag Images, which allows you to assign an image to a tag. To make use of the image, the instructions tell you add something like `echo get_tag_image($tag)` or `foreach (get_the_tags() as $tag) echo get_tag_image($tag);`, to print out the image.

    I'm guessing I could add this code in this plugin somewhere so I can have the image on top and then the tag name and count below. Just wondering if someone else on here has done this in the past? If so, could you share how you did it? I'll probably be spending the next 40 hours working on this and if I get it to work.. I"ll repost.

  21. When I choose to display less tags than I have is it possible to show an "display all" link at the end (after tha last displayed tag). This will let a visitor know there are more tags. Clicking this link should now display all tags, maybe in a new page.

    Problem is I have more than 50 tags and i want to show around half of this but with a link at the end to allow users didplay all if they like.

    1. ++

      I too would love such a feature for the same reasons. A shortcode for a tag cloud would do the trick, I think. One could use a inline PHP exec plugin but I'd prefer not to go down that road (doesn't seem to display the "flat" tag cloud correctly for me anyway; I get a list format).

Comments are closed.