I’m tagged! Bug fix for keywords-tagcloud widget
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.

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!





[...] UPDATE: added error check for when Jerome’s Keywords 2.0 is not activated. Get the latest version here. Tags:Chip’s Tips for Developers: cache jeromeskeywords php phptagcloud phptagcloud2 phptagcloud21 plugin tagcloud tagging widget wordpress Technorati: cache jeromeskeywords php phptagcloud phptagcloud2 phptagcloud21 plugin tagcloud tagging widget wordpress [...]
Thanks a lot. I should have noticed that I need Jerome’s Keywords plugin installed too. Now, Tagcloud is running but I got no tag displayed. What could be another fault (of mine)?
Did you add any tags to your posts? Manage/Posts/Edit and you’ll see a new edit box underneath the text section where you can add tags, comma-separated.
Also, check out the options in Options/Jerome’s Keywords/Tag Cloud Display.
Yeah. Thanks. I finally found a way through it.
[...] I fixed a minor bug in the tag cloud widget. PHP, globals, and nulls — oh my! [...]
What should I do if theme does not support widget?
The only way this widget is useful is if your theme supports widgets. If it doesn’t, you could add widget support to the theme, but that isn’t a trivial modification. If you’re not into PHP and WordPress code, I’d advise finding a theme that supports widgets already.
This is great. I upgraded tonight. Only had one error about a duplicate unique id when I upgraded, but nothing fatal.
The only problem I am having now is that my cloud is not scaling. I’ve set the min to 3 and the max to 10 (although I’ve tried just about everything in between).
Anyone have an example CSS I can leech?
Also, I’ve tried using style=”font-size:1.%count%em” for the cloud link format. I checked the source, and it does not seem to be changing it at all.
Jaredude, I think you want to remove font size styling for the cloud entries. The cloud uses the older syntax <font size=”n”> to scale. Make sure your CSS isn’t enforcing a font size on this section.
Perhaps I should change the widget to use CSS sizing instead, or as an option.
Yep, that’s exactly what I’m looking to do. This way, I can change the font size relative to whether it is in my left tag cloud or on a page of its own. Great tool btw! My bloggers are still getting use to it, but I love it!
You can also control the styling of each keyword size group in CSS using the selector font.keywordn, where n is the size. For example:
font.keyword1 a:link { color: 0x00FF00; }
font.keyword6 a:link { color: 0xFF0000; }
Sets fonts of size 1 to green, and fonts of size 6 to red.
[...] Go to Chips’ Tips and click “give me the code.” Follow the directions from the [...]
I am trying to use your sidebar widget to link to Jerome’s tags
I need the href value to be
http://www.domainname.com/?s=tag
instead no matter what I can only get this
http://www.domainname.com/?s=/tag
Do you know how I can generate the href without the inserted / before the tag?
This allows me to use a search everything plug-in to search my pages rather than my posts and to tag my pages rather than my posts….
TIA
AJ, how are you getting “?s=” at all? I would expect the format to be
http://www.domainname.com/?tag=tag
Just like all the links in the sidebar on the right here.
I am using Jerome’s Keyword Plug-in – under the options the keyword/search base: input box I just enter ?s=
but when it runs I get s?=/tag so something along the way is inserting a / between my custom base and the tag
Hope that makes sense:
AJ, you should just enter “s”. The “?” and “=” will be provided automagically.
Just curious, AJ — hy don’t you want to use the default “tag” command? A search (“s”) will return posts that contain that word but aren’t necessarily tagged for it.
True. I am using wordpress for a CMS and I don’t use posts – just pages – I tag my pages but the tags that are generated using the standard settings I get 404 – page not found as I dont have a folder called domainname.com/tag/
Perhaps I am missing something that would allow me to tag my pages and then have the hyperlinks call the pages not the /tag/folder ????
Sounds like you need a rewrite rule in your .htaccess file for /tag/. Unfortunately, I haven’t studied rewrite rules enough to help you on that (I use the default URL scheme), but maybe other readers or the Great Google can lead you to greater wisdom.
Does the permalink structure come into play with your plugin?
Yes, Jerome’s uses the permalink structure. BTW, I didn’t write Jerome’s Keywords, I only wrote the widget.
Doug Karr pointed me to a great intor to .htaccess here.
I think I found the issue – I use category for my permalink and somewhere the permalink structure is used to add the leading /
When I use default permalink ?postid=x then the plugin works when I use any other permalink setting it adds the /
AJ
[...] Pingback to all previous posts on this subject for the sake of those who subscribe to comments. Tags:Chip’s Tips for Developers: jeromeskeywords phptagcloud phptagcloud23 plugin tagcloud tagging thedailytwaddle w3c widget wordpress xhtml Technorati: jeromeskeywords phptagcloud phptagcloud23 plugin tagcloud tagging thedailytwaddle w3c widget wordpress xhtml [...]
AJ – I had the same issue but could not change Permalinks (never mind why).
I made the following changes and it now works:
1> Changed the Jeromes Keyword/tag search base: to /index.php?s= (for some reason just ?s= crashes the plugin?)
2> Modified the jeromes-keywords.php file and changed this line:
$this->base_url .= $this->option['query_varname'] . ‘/’;
to
$this->base_url .= $this->option['query_varname'];
in the initRewrite() method
This removes the leading ‘/’
Now the links in the tag cloud work fine – straight into the search.
Note these are tags generated by Page Keywords….does not seem to include tags from posts for some reason – I thought Jeromes did both?
Hope this helps.