Hello,
Juste a question about calling Image ID in a template :
Usually, if I choose an image attachment, I will call it like this for example :
<?php $thumb = "thumbnail";
$attachment_id1 = get_field('image1');
$thumb1 = wp_get_attachment_image_src( $attachment_id1, $thumb ); ?>
<img src="<?php echo $thumb1[0]; ?>" />
What about if this image comes from an Option Page ?
Cause when you call a field from Option, it looks like this :
<?php the_field('my_field', 'option'); ?>
But if I try this, it dœsn’t work :
<?php $thumb = "thumbnail";
$attachment_id1 = get_field('image1', 'option');
$thumb1 = wp_get_attachment_image_src( $attachment_id1, $thumb ); ?>
<img src="<?php echo $thumb1[0]; ?>" />
Any idea ? Thanks in advance for your help 🙂
Hi @vexpertine
Your code get_field('image1', 'option');
is correct. Perhaps you have a field_name spelling mistake? or perhaps a value does not exist? Or perhaps the return format is not an ID?
Try debugging the returned value.
Thanks
E