0

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

1 Answer 1

0

I discovered that by removing the footer.php file, I was removing a link to the function wp_footer(); which essentially does this:

function wp_footer() {
    /**
     * Print scripts or data before the closing body tag on the front end.
     *
     * @since 1.5.1
     */
    do_action( 'wp_footer' );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.