I am helped a guy add
SmoothGallery to his WordPress site. SmoothGallery uses mootools.
A short while later the guy installed a plugin that uses jQuery. The mootools.js script ended up being loaded after jquery.js and broke SmoothGallery. I used
wp_enqueue_script as did the other plugin.
How do I get mootools to load before jquery?
This is complicated because jquery is included with WordPress and mootools isn't.
[PHP]wp_enqueue_script('jquery-ui-core'); // Force the loading of jquery.
wp_enqueue_script('mootools', '
http://ajax.googleapis.com/ajax/libs/mootools/1.2.4/mootools-yui-compressed.js');
wp_enqueue_script('jquery', '/wp-includes/js/jquery/jquery.js', array('mootools')); // Make jquery depend on mootools
wp_enqueue_script('jd-gallery', '/wp-content/plugins/smoothgallery/scripts/jd.gallery.js', array('mootools')); // SmoothGallery depends on mootools.[/PHP]
This code does not work. jquery is loaded in the header, before mootools and the SmoothGallery scripts. jquery-ui-core is loaded in the footer.
If I move jquery-ui-core to after mootools it will work, but I cannot control when the jquery-based plugin calls its scripts. It seems to call wp_enqueue_script before my code.
(I have implemented a hack to insert 'script' tags right after the opening <head> but that isn't ideal)