1

Looking through some of the top Google results, this question has been answered a number of times, but the answers given don't seem to be working in my WP 3.6 install.

One solution given is this:

function my_thickbox() {
   if (!is_admin()) {
      wp_enqueue_script('thickbox', null,  array('jquery'), true);
      wp_enqueue_style('thickbox.css', includes_url('/js/thickbox/thickbox.css'), null, '1.0');
   }
}
add_action('init', 'my_thickbox');

Another was this: add_action( 'wp_enqueue_scripts', 'add_thickbox' ).

I've also tried using this add_thickbox() with no success.

All of these approaches seem to successfully load thickbox.css, but no JS file is showing up. I can manually go and include the path to thickbox.js, but that seems less desirable given that all of this seems to be handled by the core in script-loader.php.

1 Answer 1

1

You need to add a call of wp_footer(); function. Do it before closing body tag in your footer.php file. It should look like this:

        <?php wp_footer(); ?>
    </body>
</html>
5
  • I'm using a child theme of WP 2012. Definitely already has wp_footer() call.
    – Dan
    Sep 15, 2013 at 21:12
  • Then thickbox.js has to be at the bottom of a page, because it is rendered in the footer. Can you see it there? Sep 15, 2013 at 21:15
  • Narrowed down the issue to de-registering jquery and re-registering with the Google CDN. Removing that functionality in the child resulted in thickbox loading correctly.
    – Dan
    Sep 15, 2013 at 21:21
  • 1
    Don't re-register jquery, it's a bad habit. Shame on you :) Sep 15, 2013 at 21:24
  • If WP core would use a CDN, maybe I wouldn't have to. LOL! But if it's gonna break other functionality, I s'pose I can live with it.
    – Dan
    Sep 15, 2013 at 21:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.