WP Lightbox stopped working – jQuery version the culprit.
I just spent a while trying to figure out why a lightbox stopped working on a friend's WP site.
Supposedly nothing had changed… and looking at the code, everything looked ok.
After some trial and error, I finally figured out that the issue was with the jQuery version, the site was loading version 1.2.1, which apparently does not work with the lightbox plugin. I tried jQuery version 2.0.2, but that seems to have been too much, so I finally settled on jQuery version 1.7.1 which seem to work well with any jQuery script junning on his site.
An easy way to manually set this jQuery version in WordPress is adding some code to the theme's functions.php:
if (!is_admin()) {
wp_deregister_script(‘jquery');
wp_register_script(‘jquery', ‘http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, ‘1.7.1');
wp_enqueue_script(‘jquery');
}
}
add_action(‘init', ‘modify_jquery_version');
Just change the version numbers 1.7.1 to the one you need.
172