Retrieving the Attachment ID
# January 3, 2013 at 12:58 am
I’m using the [ACF](http://www.advancedcustomfields.com/docs/field-types/image/ “”) plugin, and am trying to work out how to return the image ID – as in a unique integer associated with that image.
I’m calling the URL like this:
< ?php the_sub_field('background_photo'); ?>
Does anyone happen to know what I have to do to return the unique ID?
Thanks in advance.# January 3, 2013 at 1:41 am
My fault. Take a look at this: http://www.advancedcustomfields.com/docs/field-types/image/
But specifically this:
$image = get_field(‘image’);
var_dump($image);# January 3, 2013 at 1:51 am
$image = get_sub_field(‘background_photo’);
“string(109) “http://localhost:8888/bit-simple/wp-content/uploads/2013/01/4acae3924ef6d13cdc85f14979a2ffe0da15cb05-copy.jpg” “
If I could just get the number inside that parentheses I’d be sorted!
You must be logged in to reply to this topic.