Support » Plugin: WordPress Gallery Plugin - FooGallery » $container96.masonry is not a function

  • Resolved Eckstein


    I am all of the sudden getting a console error when trying to display a gallery. For instance, I have a gallery set to the masonry settings, and it is not working. When I check the console, I see the error $container96.masonry is not a function. I’ve tried deleting and re-installing the plugin with no luck. Any advice?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author bradvin


    What version of FooGallery are you using? You can try using the develop branch to see if that fixes your issue :

    Otherwise, pls post your site’s URL so I can have a look


    Already I fixed that issue by changing \extensions\default-templates\gallery-masonry.php. I changed script which was generated by PHP – from jQuery to Vanilla JavaScript and moved script AFTER HTML.

    <div id="foogallery-gallery-<?php echo $current_foogallery->ID; ?>" class="<?php echo foogallery_build_class_attribute( $current_foogallery, 'foogallery-lightbox-' . $lightbox ); ?>">
    <?php foreach ( $current_foogallery->attachments() as $attachment ) {
    		echo '	<div class="item">' . $attachment->html( $args )  . '</div>
    	} ?>
    		var container_<?php echo $current_foogallery->ID; ?> = document.getElementById("foogallery-gallery-<?php echo $current_foogallery->ID; ?>");
    		var msnry = new Masonry( container_<?php echo $current_foogallery->ID; ?>, {
    		  	itemSelector: '.item',
    			columnWidth: <?php echo $width; ?>,
    			gutter: <?php echo $gutter_width; ?>,
    			isFitWidth: <?php echo $center_align ? 'true' : 'false'; ?>

    @tomciopl Well, I don’t really want to edit the plugin files directly if I can avoid it, but thanks.

    @bradvin I tried the dev version with the same result. Here is the link to the page: You can see all the images at the bottom. Thanks.

    This has seemed to fix itself as mysteriously as it broke. Looked at the page again today and it’s working fine again. I haven’t made any changes to code or theme settings, so it’s very strange…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘$container96.masonry is not a function’ is closed to new replies.