acf get image id sub_field

93

<?php
$imageID = get_sub_field('your_field');
$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; ?>" />

Comments

Submit
0 Comments