work.php 1.04 KB
<?php

/**
 * Work Block Template.
 *
 * @param   array $block The block settings and attributes.
 * @param   string $content The block inner HTML (empty).
 * @param   bool $is_preview True during AJAX preview.
 * @param   (int|string) $post_id The post ID this block is saved to.
 */

?>
<?php if( have_rows('work') ): ?>  
    <?php $rowCount = count( get_field('work') ); //GET THE COUNT ?>

	<?php $i = 1; ?>
    <div class="tiles">          
    <?php while( the_repeater_field('work') ): ?>
        <div class="tile <?php if($i == $rowCount): ?>  last	<?php endif; ?>">
            <div class="tile_image" style="background-image:url(<?php the_sub_field('background_image'); ?>);">
                <div class="hover_content">
                <?php the_sub_field('hover_text'); ?>
                </div> 
                <div class="tile_content"> 
                    <?php the_sub_field('content'); ?>
                </div>
            </div> 
        </div>
        <?php $i++; ?>
    <?php endwhile; ?>
<br clear="both">
</div>
<?php endif; ?>