1
votes

I've built a Wordpress theme using jQuery Masonry. I host the Masonry script locally while using Google's hosted jQuery script. Masonry works just fine. But for some reason, I need to call both Masonry and jQuery in the footer in order for Masonry to work. But doing this, disables various Wordpress plugins that use jQuery. It seems my plugins require jQuery to be called in the header while Masonry needs it to be in the footer.

How can I resolve this conflict?

2

2 Answers

1
votes

You should load jQuery using the wp_register_script method:

function my_init() {
    if (!is_admin()) {
        // comment out the next two lines to load the local copy of jQuery
        wp_deregister_script('jquery');
        wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js', false, '1.7.2');
        wp_enqueue_script('jquery');
    }
}
add_action('init', 'my_init');

http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/