Created
November 28, 2017 13:11
-
-
Save GuillaumeEudes/972771769cae4a9982b63a28d57bce7c to your computer and use it in GitHub Desktop.
Get the first row from a repeater
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$rows1 = get_field('galerie_isolation' ); // get all the rows | |
$first_row1 = $rows[1]; // get the first row | |
$title1=$first_row1['titre_galerie']; | |
$first_row_image1 = $first_row1['les_images' ]; // get the sub field value | |
?> | |
<?php if( have_rows('galerie_isolation') ): | |
while ( have_rows('galerie_isolation') ) : the_row(); ?> | |
<div class="title_slide"> | |
<h3><?php echo $title1 ?></h3> | |
<div class="nav"> | |
<span class="ion-arrow-left-c prev-button"></span> | |
<span class="ion-arrow-right-c next-button"></span> | |
</div> | |
</div> | |
<div class="main-carousel"> | |
<?php $images = wp_get_attachment_image_src( $first_row_image1, 'full' ); | |
if( $images ): ?> | |
<?php foreach( $images as $image ): ?> | |
<img class="" src="<?php echo $image[1]['url']; ?>" alt="<?php echo $image[1]['alt']; ?>" /> | |
<?php endforeach; ?> | |
<?php endif; ?> | |
</div> | |
<?php endwhile; endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment