Thickbox and jQuery in WordPress 2.8

The update was great! The new features in WordPress 2.8 are awesome! Most of my Twitter friends have updated to 2.8 and haven’t had a single issue. The new widgets area is so cool! Oh jeez, I’m so excited. For a full features list check out Version 2.8 section in the Codex.

Anyway, the only issue I had so far is the Thickbox usage. I’m not sure why it’s lost, but I’ve discovered it in the Quick Flickr Widget plugin when upgrading. The thickbox feature worked fine in 2.7 and 2.7.1. For an unknown reason, WordPress 2.8 doesn’t call the thickbox.js file through wp_enqueue_script. The other js libraries work fine though (prototype, scriptaculous). jQuery’s being called out too btw, cause it’s a dependency of Thickbox, but thickbox never shows up. This is actually weird. I hope I’m not the only one with this issue, cause it’s starting to feel bad ;)

I’ll submit a bug ticket to their Trac for 2.8.1, but until that here’s a temporary workaround:

global $wp_version;
if ($wp_version == "2.8") wp_enqueue_script("thickbox28", "/wp-includes/js/thickbox/thickbox.js", array("jquery"));
else wp_enqueue_script("thickbox");

Hope this helps. And don’t forget to inject the thickbox CSS and javascript settings in the wp_head action.

Update: Thickbox loads in the footer section in WordPress 2.8, that should be right before the closing body tag. And yes, loads of themes are lacking the wp_footer() function call. So, forget about the workaround, fix your themes first.

The 1.2.9 update of Quick Flickr Widget included the fix above, so 1.2.10 reverts that fix back to the standard way, sorry for the hassle ;)

9 thoughts on “Thickbox and jQuery in WordPress 2.8

  1. You're right! My theme was not calling the wp_footer() function, so that's why thickbox was not working… thanks!

  2. Same problem here in WP 2.8.4 your code solved the issue.
    Only one thing: since version is 2.8.4 instead of 2.8 i've changed the if condition to match the "main" WP version

    if (strpos($wp_version,"2.8") !== false)

  3. HOWTO/FIX: ThickBox and Wordpress 2.8 issues «

Comments are closed.