Skip to content

Instantly share code, notes, and snippets.

@jackfearing
Last active August 8, 2023 14:51
Show Gist options
  • Save jackfearing/0d53e020b73cf0632ac73c8c975c87cb to your computer and use it in GitHub Desktop.
Save jackfearing/0d53e020b73cf0632ac73c8c975c87cb to your computer and use it in GitHub Desktop.
<div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($classes); ?>">
<?php
$repeater_field = get_field('tiles');
if ($repeater_field) {
$index = 1;
?>
<div class="tile__container">
<?php
while (have_rows('tiles')) : the_row();
$class_name = 'class-name-' . $index;
?>
<div id="tile-<?php echo get_row_index(); ?>" class="tile__items <?php echo $class_name; ?>">
<h3><?php the_sub_field('tiles_title'); ?></h3>
<?php the_sub_field('tiles_content'); ?>
</div>
<?php
$index++;
endwhile;
?>
</div> <!-- tile__container -->
<?php
}
?>
</div>
<div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($classes); ?>">
<?php
$repeater_field = get_field('tiles');
if ($repeater_field) {
$index = 1;
?>
<div class="grid-container">
<?php
while (have_rows('tiles')) : the_row();
$class_name = 'class-name-' . $index;
?>
<div class="grid-item">
<h3><?php the_sub_field('tiles_title'); ?></h3>
<?php the_sub_field('tiles_content'); ?>
</div>
<?php
$index++;
endwhile;
?>
</div> <!-- tile__container -->
<?php
}
?>
</div>
<div id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $classes ); ?>">
<?php $repeater_field = get_field('tiles'); ?>
<?php if ( have_rows( 'tiles' ) ) : ?>
<div class="tile__container ">
<?php while ( have_rows( 'tiles' ) ) : the_row(); ?>
<div id="tile-<?php echo get_row_index(); ?>" class="tile__items">
<h3><?php the_sub_field( 'tiles_title' ); ?></h3>
<?php the_sub_field( 'tiles_content' ); ?>
</div>
<?php endwhile; ?>
</div> <!-- tile__container -->
<?php else : ?>
<?php // No rows found ?>
<?php endif; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment