Last active
January 8, 2019 21:02
-
-
Save eclarrrk/e38052c6fa86d6f3d44678febbdefea1 to your computer and use it in GitHub Desktop.
Get the URL for a specific size of an attachment image
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 | |
$size = 'large'; | |
$image_ID = get_field('field_name'); // when using ACF, choose 'Image ID' for return value | |
$image_array = wp_get_attachment_image_src($image_ID, $size); | |
$image_URL = $image_array[0]; | |
echo $image_URL; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment