Skip to content

Instantly share code, notes, and snippets.

View outbravedigital's full-sized avatar

Duncan Michael-MacGregor outbravedigital

  • Outbrave Digital Limited - Web Design & Digital Marketing Agency
  • Vancouver, Canada
View GitHub Profile
View Get alt-text on image with acf-repeater field
<?php
if( have_rows('acf_repeaterfield') ):
while ( have_rows('acf_repeaterfield') ) : the_row();
$imageID = get_sub_field('acf_subfield');
$image = wp_get_attachment_image_src( $imageID, 'full' );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
?>
<img src="<?php echo $image[0]; ?>" alt="<?php echo $alt_text; ?>" class="port-img front" />