sazuka09
Member
Posted 2 years ago #
Good morning everyone,
I tried to follow some tutorials but some are specified to meta tags etc..
I just wanted to have a simple custom field ex. IMGURL and be able to add url links inside.
What I dont know is how to put it inside the template
<img src="$IMGURL">
something like that...
Hope someone can help me a bit... Thank you
sazuka09
Member
Posted 2 years ago #
I tried this as well:
<?php $image = get_post_meta($post->ID, 'Image', true); ?>
<img src="<?php echo $image; ?>" alt="" />
But it showed only empty <img src="">
You are using that inside a $post loop correct.
Do echo 'post id: '.$post->ID; to make sure there's something there.
If necessary, please paste all the code from the template file into a pastebin such as wordpress.pastebin.com, and report the link back here. Maybe someone can spot your problem. Thanks.
sazuka09
Member
Posted 2 years ago #
I tried the echo:
echo 'post id: '.$post->ID;
and the results were correct actually:
<img src="post id: 231" alt="" />
seems like the custom field just doesnt want to show up..?
Or there is not an "Image" custom field for that post.