• Resolved Tedmanders

    (@tedmanders)


    I have a repeater template with some php code to add html after an x amount of posts. Somehow this breaks the load more functionality.
    If I only keep the div with class ‘post’ it works, but when I add the container wrap and blog-left on top and the </div> on the bottom it breaks.
    This means it will show the first 4 posts and a load more button, but the button does not respond. (Scrolling load more does not seem to work at all).

    Here is the code I am using:

    <?php if($alm_current%4 === 1 || $alm_current === 1) { ?>
    	<div class="container wrap-<?php if($alm_current%2 === 0){echo 'even';} else {echo 'odd';} ?>">
    		<div class="blog-left">
    <?php } ?>
    
    			<div class="post-<?php echo $alm_current; ?> posts">
    				<a href="<?php the_permalink(); ?>">
    				<?php the_post_thumbnail(); ?>
    					<div class="post-label">
    						<?php if (get_post_type() == 'projecten') { ?>
    							<span class="type-tag">Project</span>
    						<?php }
    						if (get_post_type() == 'post') { ?>
    							<span class="type-tag">Nieuws</span>
    						<?php } ?>
    						<span class="blog-title"><?php the_title(); ?></span>
    					</div>
    				</a>
    			</div>
    
    	<?php if($alm_current === 3 || $alm_current%4 === 3) {
    		echo '</div>';
    	} ?>
    <?php if($alm_current%4 === 0) {
    	echo '</div>';
    } ?>

    Thank you for any help you can provide.

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi TM,
    This repeater won’t work because each template needs to open and close with the same HTML element. And in your example, you are attempting to wrap all objects in a container.

    <div>
     // your content
    </div>

    What’s happening is ALM is counting the amount of return objects and because you have an opened div (.container) it thinks there are not enough posts being returned and is adding the (.done) class to your button.

    If your looking for a grid layout, the Layouts add-on provides a fully responsive grid in 1, 2 or 3 columns.
    https://connekthq.com/plugins/ajax-load-more/add-ons/layouts/

    Thread Starter Tedmanders

    (@tedmanders)

    Hi dcooney,

    Thank you for clarifying what happens.
    I understand the problem and will try to fix it another way.
    I’ll check out the link.

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Repeater template breaks load more’ is closed to new replies.