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!

24 Responses to “Tag cloud widget for WordPress gets all standardsy on you”

  1. [...] new version with improved font sizing here Tags:Chip’s Tips for Developers: aoyoyo jeromeskeywords phptagcloud phptagcloud22 widget [...]

  2. Jenn says:

    Awesome! I really like that the font-scaling matches the count. So simple!

  3. Jenn, thanks for giving me the impetus to create this version! I like it much better than what I had before.

  4. J. Pisano says:

    Chip,

    This is a little off topic, but I figure you’re the best one to ask this of (especially since your so active a blogger). I was reading in Jerome’s Plugin space, that his plugin automatically adds keywords to the RSS Feed “in the proper format”. Here is the link to the quote:

    http://vapourtrails.ca/wp-keywords/wp-keywords-technorati

    I’ve searched all over the web and cannot find anything about adding tags, let alone in the “Proper Format”. As, I no longer use My WordPress Site to Generate my feed, I’m now feeling that I might be missing something… like tags!

    Is it a just a simple text at the end?

    Any thoughts?

    J. Pisano -MUSicTECHnology.net
    http://www.mustech.net

  5. J. Pisano,

    I don’t use ATOM — I’ve redirected my ATOM feed to my RSS 2.0 feed, and let FeedBurner translate as needed. for Technorati, I modified my theme to include tags in the Technorati format. Like so:

    <a href=”http://technorati.com/tag/tagname/” title=”Technorati tag page for tagname” rel=”tag”>tagname</a>

  6. J. Pisano says:

    Chip,

    Thanks for the info, I started to break apart what Jerome was doing and appears that he is adding multiple category entries to each in the RSS feed. He is doing this with a keyword here tag for each of the keywords inputed into his interface in the post/page screens for each post and page entry.

    RSS does allow for this as does Atom (I think), but there really aren’t many programs or RSS editors that allow you to input more than one category as an option in them, so it would be a real cumbersome thing to do manually in XML, thus Jerome’s automagic inputting is a good idea for doing this type of thing. It would be interesting to find out the SEO value of having multiple categories linked with each item in an RSS feed. I too use a feedburner replacement feed for all of my feeds found at my website.

    Thanks for the quick response!

    J. Pisano -MUSicTECHnology.net
    http://www.mustech.net

  7. cooper says:

    I just downloaded this newer version, thanks. I am currently reading your feedburner post which is interesting as all I thought I had to do was sign up at feedbruner…hummm.

    Also this is way off topic but I figure you might be able to direct me to a resource to teach me very specifically how to widgetize my footer to be styled for three columns.

  8. Hey cooper!

    Signing up at FeedBurner gives you a feed there, but WordPress exposes your feed in at least two ways: a clickable link and auto-discovery (a <link> tag with rel=”alternate” type=”application/rss+xml” title=”RSS 2.0″). The href on both the link tag and the clickable link usually lead you to sitename/feed/ or sitename/?feed=rss2 or something like that. To use FeedBurner, that link needs to get redirected to the feedburner link (usually http://feeds.feedburner.com/sitename). My hack does that for you. Of course, you could also just change the links in your template, but then if someone happens to know that your site uses WordPress and invokes /?feed=rss2, they’ll miss FB.

    Regarding a three-column footer with widgets: The first thing you have to do is register the number of sidebars you want. Typically this is done in functions.php in your theme files. Call register_sidebar for every sidebar. Probably a good idea to test if (function_exists(‘register_sidebar’) first (unless you’re already on WP 2.2) because the sidebar plugin can get deactivated which would cause an error if you don’t test.

    After you’ve added that code to register the sidebars, they’ll show up in the admin panel and you can drag widgets to them.

    In your footer.php for your theme, just add a call to dynamic_sidebar(n) for each sidebar where you want them to go. For n, pass the numeric index of the sidebar you want (starting with 1). Good again to test if function_exists(‘dynamic_sidebar’).

    Clear as mud? If you like, you can send me your theme files and I’ll see if I can pop those babies in for you.

  9. cooper says:

    I’m going to have to look into the feedburner thing when I have the chance.

    Thanks for the offer of looking at my footer. I changed the theme for now.
    I’m going to do that meme this weekend – weekends are for fun.;)

  10. Cool — looking forward to it!

  11. xfuture says:

    hi,

    This is what i looking for, thanks for this useful wordpress plugin :)

  12. Glad you like it, xfuture. As soon as you have it up on your site, hurl me an URL and I’ll link to it.

  13. Will it work with WordPress 2.2.1?

  14. Yes, Rico. I tested it just now. Thanks for reminding me I need to upgrade.

  15. Thanks for the wordpress login. It will be useful for me.

  16. Glad you like it, Jon.

  17. jake says:

    It wouldn’t be surprising but… am I missing something?

    I have everything installed and activated but, when I put it in my wordpress sidebar there aren’t any tags under the title.

    any help would be appreciated.

    Thanks!

  18. jake says:

    alright, so I’m an idiot.

    nevermind, I, for some reason, have never seen the whole “TAGS” part of a post.

    now that I have done that everything works beautifully.

    Thanks.

  19. mark o'toole says:

    Hi,

    I can set the font size to ex but I cannot set the range, the jerome’s keyword link on the options page does not work, the PHP page is there but it doesnt seem to do anything, I get a black white page when I click the link. At the moment my tag cloud text is too small to read.

    Can you help?

    thanks a million, I love the widget and would love to be able to use it.

    Mark

  20. daaan says:

    CSS is great things in the world

Leave a Reply

Better Tag Cloud