Skip to content

Instantly share code, notes, and snippets.

Created March 14, 2016 11:47
What would you like to do?
A short snippet for use in stack exchange (wordpress).
<?php //remove this
function loop_p_arch_infinite_scroll_render() {
$paged = get_query_var( 'paged', 1 );
<div id="page-<?=$paged?>">
<?php while( have_posts() ) {
get_template_part( 'content', 'product' );
<script id="script-page-<?=$paged?>">
jQuery('document').ready(function() {
var new_elements = jQuery('#page-<?=$paged?>').children('.grid-item');
.isotope('appended', new_elements)
.imagesLoaded( function() {
jQuery('#page-<?=$paged?>, #script-page-<?=$paged?>').remove();
Copy link

ztudeny commented Apr 10, 2016

Thanks for the code, it`s great. Just sometimes images does not load properly to isotope and I am getting error "Uncaught TypeError: jQuery(...).isotope(...).imagesLoaded is not a function". Any idea how to fix this?
Thanks a lot and have a great day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment