ACF inside ALM not counting loops?
-
So, I’m using a ACF content repeater as a template on ALM, and I want it to stop at 8 items, but $alm_item is always 1. I’ve tried to add $alm_loop_count and defining $alm_item as 0 and then $alm_item++, but all I’m getting now is an internal server error on the console.
template repeater I’m using:
<?php $alm_loop_count = 0; $alm_page_count = 0; (have_rows('work_gallery')): ?> <?php while (have_rows('work_gallery')): the_row(); $alm_loop_count++; if ($alm_loop_count > 8) { $alm_page_count++; $alm_loop_count = 0 } var_dump($alm_loop_count); var_dump($alm_page_count); ?> <div class="col-xs-12 col-sm-6 gallery-item tag-all <?php $tags = get_sub_field('tags'); if( $tags ) { foreach($tags as $t) { $t = get_category($t); echo 'tag-'.$t->name.' '; } } ?>" style="background-image:url('<?php echo the_sub_field('image'); ?>');"> <div class="client-logo"> <img class="img-responsive" src="<?php echo bloginfo('template_url');?>/images/<?php echo the_sub_field('client_logo');?>" alt="<?php echo the_sub_field('client'); ?>"> </div> <div class="tags"> <ul> <?php $tags = get_sub_field('tags'); if( $tags ) { foreach($tags as $t) { $t = get_category($t); echo '<li>'.$t->name.'</li>'; } } ?> </ul> </div> <h2> <?php echo the_sub_field('title'); ?> </h2> <a href="<?php echo the_sub_field('link'); ?>" class="btn btn-reverse">View Work</a> </div> <?php endwhile; ?> <?php endif; ?>
And on the page-template:
<?php echo do_shortcode('[ajax_load_more post_type="page" post_format="standard" posts_per_page="8" scroll="false" transition="fade" button_label="see more work" button_loading_label="Loading..."]' ); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘ACF inside ALM not counting loops?’ is closed to new replies.