Chip's Tips for Developers

Contains coding, but not narcotic.

Tag cloud widget for WordPress gets all standardsy on you

May 18th, 2007 10:51:08 am pst by Sterling Camden

Call me clueless, but I did not know until I found out from Jenn that the <FONT> element has been deprecated and will not validate XHTML 1.0 strict DTD.  The keywords-tagcloud widget for WordPress uses that element with a SIZE attribute to scale the tags in the cloud (extends wrists, awaiting slap).

Far be it from me to fly in the face of progressing standards, so I have just released version 2.3 of the keywords-tagcloud widget that uses a STYLE element specifying font-size instead.  You can get it by pressing the button below.

Besides averting a visit from the W3C police, using the font-size style provides much more flexibility on how the font is, um, sized.  You got pixels, percentage, etc. to choose from.  So I added a field to the widget’s control panel where you can specify what units to use.  The scaling maximum/minimum fields in Options/Jerome’s Keywords/Tag Cloud Display can be used to control the range of units to apply.  Unfortunately, these values get rounded down to the nearest integer, so “em” doesn’t work well for units.  Also, CSS units don’t provide an exact mapping for the old font size attribute, but “ex” is pretty close, so I made that the default.  However, I found that “%” with a range of 70-250 looks nicer for my theme, and you can see that on the right sidebar here.

If you do your own styling of the widget, make sure you read the upgrade notes.

Thanks, and keep on tagging!

Pingback to all previous posts on this subject for the sake of those who subscribe to comments.

Posted in CSS, PHP, Web, Wildly popular, WordPress | 24 Comments » RSS 2.0 | Sphere it!

I’m tagged! Bug fix for keywords-tagcloud widget

February 2nd, 2007 10:36:24 am pst by Sterling Camden

Aoyoyo reported an error in my keywords-tagcloud widget for WordPress. That widget requires Jerome’s Keywords version 2.0 to be installed and activated. Lazy me, I wasn’t checking for the opposite case, which results in a “Fatal error: Call to a member function on a non-object”. Here are my wrists. Slap ‘em hard.

jkwarning

Version 2.2 (download below) corrects this problem. If Jerome’s Keywords 2.0 is not activated, you now get a warning message displayed in the Presentation admin panel for the widget and also in place of the tag cloud display.

Version 2.0 of Jerome’s Keywords wraps the plugin’s API in a global object. If the plugin isn’t activated, the global is null. So, I only needed to add a simple test for is_object($JKeywords) to respond appropriately, instead of spilling my guts on your blog.

UPDATE: new version with improved font sizing here

Posted in PHP, Web, WordPress | 24 Comments » RSS 2.0 | Sphere it!

Improved caching on tag cloud widget for WordPress

January 3rd, 2007 6:09:27 pm pst by Sterling Camden

Version 2.1, for use with Jerome’s Keywords plugin version 2.

I’ve been putting off updating the tag cloud widget for some time, because Jerome had indicated that he would include it in his plugin in a future version. That hasn’t happened yet, so I wanted to add a couple of new features now:

  1. You can now control the expiration of the cached display. It still defaults to 900 seconds, but you can alter it to be anything you wish.
  2. Besides releasing the cache when the widget controls are updated, it also releases the cache when a post is edited, saved, or published.

Please let me know if you experience any difficulties, or if you have suggestions for further enhancements.

Happy tagging!

UPDATE: added error check for when Jerome’s Keywords 2.0 is not activated. Get the latest version here.

Posted in PHP, Web, Wildly popular, WordPress | 12 Comments » RSS 2.0 | Sphere it!

WordPress tag cloud widget version 2.0 for Jerome’s Keywords 2.0

September 6th, 2006 11:04:31 am pst by Sterling Camden

vapourtrailsJerome has released a 2.0 beta version of his famous Jerome’s Keywords plugin, on which my tag cloud widget is based. Some of the functions I used in my widget are no longer available, so the previous version of my widget will not work with it. Thus, I have updated the widget, which you can download below.

Jerome seems to have fixed the problems in the plugin itself that I mentioned here and here. When he releases this version from beta, I’ll remove my corrected versions. I’ll go ahead now and add updates to let people know about the beta.

tagcloudoptionsJerome also included all of my widget’s options (other than Title) in a new “Tag Cloud Display” section of the plugin’s options. So, I have removed those options from the widget option panel. Please go into “Options/Jerome’s Keywords” and update your tag cloud options there.

Note also that this version of the widget is not compatible with earlier versions of the plugin. If you need a widget for earlier versions of Jerome’s Keywords, get version 1.1 of the widget here.

UPDATE: Get the latest version with improved cache control here.

Posted in PHP, SQL, Web, Wildly popular, WordPress | 67 Comments » RSS 2.0 | Sphere it!

Tag cloud sidebar widget for WordPress

June 14th, 2006 7:29:40 pm pst by Sterling Camden

On the advice of Alec Saunders, I enabled tagging in my blog using the Jerome’s Keywords plugin for WordPress 2.0. It has a lot of nice features and good documentation. It even provides a great function for generating a tag cloud, where you can render tags differently depending on their usage without much trouble. However, it doesn’t provide a sidebar widget, and you can’t just plunk PHP code into a text widget, because it isn’t executed on the server. So, I decided to write this little widget that you can download below.

Installation and configuration instructions are included in the readme.txt file enclosed.

UPDATE: I added caching to improve performance, using the default expiration of 900 seconds (15 minutes). That saves a database SELECT and quite a bit of processing. You can release the cache by saving changes to the widget in the WordPress dashboard.

UPDATE: I have corrected a couple of problems in the Jerome’s Keywords plugin itself. You can get that here.

UPDATE: Jerome released a 2.0 beta version of the plugin. To get a compatible version of the widget, go here.

Posted in PHP, Wildly popular, WordPress | 4 Comments » RSS 2.0 | Sphere it!

Better Tag Cloud