Forked from pigmentGit/Get alt-text on image with acf-repeater field
Last active
August 29, 2015 14:24
-
-
Save outbravedigital/24beee16c60c2212ad46 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
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" /> | |
<?php | |
endwhile; | |
else : | |
// none | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment