Created
March 28, 2014 19:10
-
-
Save galengidman/9840672 to your computer and use it in GitHub Desktop.
get ACF image size URL by image object
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 | |
// first, get the image object returned by ACF | |
$image_object = get_field('my_image_field'); | |
// and the image size you want to return | |
$image_size = 'thumbnail'; | |
// now, we'll exctract the image URL from $image_object | |
$image_url = $image_object['sizes'][$image_size]; | |
?> | |
<img src="<?php echo $image_url; ?>" alt=""> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment