Last active
November 24, 2017 07:10
-
-
Save skkim7821/f16262c1cb58282057835e81c1e3980a 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
// acf/includes/api/api-helpers.php | |
function acf_get_simple_attachment( $post ) { | |
// post | |
$post = get_post($post); | |
if( !$post ) return false; | |
$sizes = ['thumbnail', 'medium', 'large', 'full']; | |
// vars | |
$id = $post->ID; | |
$thumb_id = $id; | |
$a = []; | |
// sizes | |
if( $thumb_id ) { | |
foreach( $sizes as $size ) { | |
$src = wp_get_attachment_image_src( $thumb_id, $size ); | |
$a[ $size ] = [$src[0], $src[1], $src[2], $src[3]]; | |
} | |
} | |
// return | |
return $a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment