I’m making a custom implementation of JQuery Colorbox in a WordPress plugin. However, it’s not working with my default WordPress installation. After tinkering a bit, it comes down to the inclusion of the JQuery library.
Neither of these lines work:
<script src='http://xpisobsolete.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
But either one of these do:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
I’ve tested that JQuery works with all of the above by using:
if (typeof jQuery != 'undefined') {
alert("jQuery library is loaded!");
}else{
alert("jQuery library is not found!");
}
It passes on all four of the script links I’ve tried. If I change that one line on Jack’s demo page, it breaks as well. Is this a colorbox issue?
http://www.jacklmoore.com/colorbox/example1/
Could you guys help me see what I’m missing here? I’m stumped.
Try placing your code in this
I’m suspecting your code uses
$
, which is normally an alias forjQuery
but doesn’t work globally because WP’s version ofjQuery
is in no conflict mode.$
will work if the code is placed in an enclosure such as the one above.