I am trying to echo the image src of an image I have uploaded for my custom post type outside of the while loop.
I have used the following:
$custom_fields = get_post_custom($_GET['id']);
I can easily now use this code to get, for example the phone number:
echo $custom_fields['telephone'][0]; // e.g. returns 0800 555 222
However, when I try to get an image using the same code, all I get back is a number.
echo $custom_fields['logo'][0]; // e.g. returns 247
Doing a var_dump of $custom_fields, it seems as though I cannot load this data outside the loop using this function. Does anybody know what I’m supposed to do here without having to do a loop?
I believe you can get away with
and then display it with