My Tag Cloud |

My Tag Cloud

This plugin started as a request over at Kim’s blog. It turned out it was needed so here it is!


My tag cloud provides you with a widget that actually gives you the ability to list the tags of your posts in a diiferent way than a tag cloud. It list the first 5, most popular or alphabetically depending on the preferences, as an unordered list and the rest are put in a dropdown.



Download the plugin from here: My Tag Cloud (2301) - 9.24 KB. Then place the file my_tag_cloud.php that can be found in the archive in your plugin directory. Activate it from the plugin management in your administration area. Finally, place the widget to your sidebar!


Setting the preferences

The default way the plugin works is this. It renders the 5 most used tags in an unordered list and the following are added on a dropdown. You can change this, along with the title, from the settings area within the code. Please open my_tag_cloud.php with your favorite text editor and notice the following code segment from line 18.

  1. /*——– PREFERENCES START ——–*/
  2. $list_tags = 5;//how many tags to show on the list before adding to the dropdown
  3. $widget_title = ‘My Tag Cloud’;//title of the widget
  4. $order_tags = ‘count’;//you can set this to "count" or "name".
  5.                       //Count means the most popular will come first, name means they will be ordered alphabeticaly
  6. /*——– PREFERENCES END ———-*/

Note the following:

  • list_tags: This indicates how many tags should be listed on the unordered list.
  • widget_title: It’s obvious, this is the title the widget will have.
  • order_tags: This is the way you will order tags. You have two options: ‘count‘ or ‘name‘. If you choose ‘count‘ then the tags will be ordered from the most used to the least used. If you choose ‘name‘, they will be ordered alphabetically.

Shortening the tags

I got a very valid point as a valued feedback from a user here. As it seems the plugin actually broke his theme. The dropdown exceded the width of the widget so it looked bad. What happens is this. The dropdown’s length is defined from the bigger text in it. It seems he had “Search Engine Optimization” as a tag. You see it’s pretty big. To fix this you can trim your tags and add some “…” at the end. To do so please take a look at line 54. It says:

  1. echo ‘<option value="’.$tags[$i][‘name’].‘">’.$tags[$i][‘name’].‘ (‘.$tags[$i][‘count’].‘)</option>’;

You need to remove that line and add the following:

  1. $tag_length = 20;
  2. if(strlen($tags[$i][‘name’]) > $tag_length){
  3.     $tag_text = substr($tags[$i][‘name’], 0, $tag_length).‘…’;
  4. }
  5. else{
  6.     $tag_text = $tags[$i][‘name’];
  7. }
  8. echo ‘<option value="’.$tags[$i][‘name’].‘">’.$tag_text.‘ (‘.$tags[$i][‘count’].‘)</option>’;

Please note that “20” which is the tag length is actually how many characters you want your tag not to exceed.

35 Responses to “ “My Tag Cloud”

  1. Raju says:

    Kudos mate!! that was fast and neat ❗

  2. Raju says:

    by the way, don’t you think the submit button for the comment should be below the captcha box? 😉 Sorry for posting something unrelated to the post, gonna try the plugin soon

  3. stratosg says:

    @Raju: thanks for the feedback. actually my captcha was messed up today after they released some kind of update… i’ll probably change it at some point… as for the plugin thx and please come back if you have any problems/suggestions…

  4. Sire says:

    Hi, sorry to be a pain, but I did that tweak for shortening the tag and now I get the following error and not blog

    Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /home/loadofbu/public_html/ on line 61

    I’ve uploaded the backup to get rid of it.

  5. stratosg says:

    you are not a pain at all. it’s my pleasure. about the problem i think it’s my stupid code highlighting plugin. please make sure you replace all “`” with “‘”. Notice the difference? I saw this was all over the place. If this doesn’t work come back with the problem you face…

  6. Sire says:

    OK, I have to replace all the ‘ with ” is that what you mean, because there are a whole lot of ‘ in line 61? If it’s easier, just email me the code at [email was here]

  7. stratosg says:

    ok i changed my code highlighting software. please choose on “view code” and then copy-paste the same segment. if you still have a problem let me know and i’ll mail you. by the way i removed the email you provided for spamming reasons 😉

  8. Sire says:

    That did it. Thanks stratosg. I had to change the value to 18 and now it is perfect. You are a Greek Legend

  9. […] Stratosg heard the call and developed the plugin. I installed his “MY Tag Cloud” plugin today and it worked fine except that it broke the widget box. I left a comment on his […]

  10. Mike Nichols says:

    Thanks for another great plugin, Stratos! I’ve already installed it and it works great. I don’t like tag clouds (slows down page load, too big), but wanted tags. Now I have tags and categories right next to each other!

  11. stratosg says:

    Thanks for the comments to both of you. I hope it serves you well and if you have any problems please feel free to come back here and i’ll take care of it 🙂

  12. […] My tag cloud provides you with a widget that actually gives you the ability to list the tags of your posts in a diiferent way than a tag cloud. It list the first 5, most popular or alphapbeticaly depending on the preferences, as an unordered list and the rest are put in a dropdown. – Release page […]

  13. baron says:

    hi. Thanks for plugin



  14. […] dem WordPress Plugin My Tag Cloud von stratosg kann  eine einstellbare Menge an Tags über ein Widget in einer Liste angezeigt […]

  15. […] Télécharger le plugin My Tag Cloud […]

  16. Abdulrehman says:

    I don’t say that the plugin is not good but if you have seen the flash tag cloud which is available as a plugin, that is pretty creative. You should have tried something like that!

  17. stratosg says:

    @Abdulrehman: Well it’s true the flash tag cloud is way nicer but this is way simpler and lighter. So it all depends on what you want 😉 Thanks for dropping by!

  18. Funny Stuff says:

    This is a pretty sweet plugin, I might look into implementing this when I redesign one of my blogs. I currently don’t like how most tag clouds look but I like the list idea of this one.

  19. […] other news, November was plugin month. I released two of them (YAFootnotes and “My Tag Cloud“) that were endorsed by the people and brought in quite a few traffic. I met a few new […]

  20. Leo says:

    How can i show this as a page? Not as a widget.

  21. sam says:

    Hi, thanks for the plugin, really needed this.
    its not working though! I have it installed fine, but the list of tags produced do not point to the ‘tag archive’ pages they should.
    I get
    “Not Found
    The requested URL /wordpress/tag/existing-buildings was not found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request”

    it seems that it should be pointing to

    Any help appreciated.

  22. stratosg says:

    @sam: As you can see i already had this problem with a previous version. I guess a good way would be to do it from within the code…

  23. […] provided exactly what I needed. I have used (until now) only three plug-ins, AStickyPostOrderER, My Tag Cloud and Widget Logic which I find very useful and highly recommendable. Especially Widget Logic […]

  24. thushy says:

    Thanks for the useful widget

Leave a Reply