So I am current building a site with the pieces theme which has built in masonry. When the theme was stock, the masonry was working however as I have begun to make modifications to the theme I have now noticed the error "Can't find variable imagesLoaded". I would just go back to stock and re-make the theme with my customisations being careful to check for errors after each change however that is going to take too long. I thought I would ask here to see if anyone else has had this issue recently. I know there is one other question on here similar to this and I tried to use the code from that but was slightly unsure about exactly what to do with it. Could it be that I loaded jQuery in the header.php for a custom jQuery dropdown menu I put in? The masonry code from the functions.php file is as follows:
if ( ! is_admin() ) :
// Deregister built in masonry since it is old version 3.
wp_deregister_script( 'jquery-masonry' );
// Load imagesLoaded plugin.
wp_enqueue_script( 'imagesLoaded', get_template_directory_uri() . '/js/imagesloaded.pkgd.min.js', false, null, true );
// Load newer masonry.
wp_enqueue_script( 'masonry', get_template_directory_uri() . '/js/masonry.pkgd.min.js', array( 'imagesLoaded'), null, true );
endif;
Many Thanks