Properly attach an image to a post
-
I have created a custom field called avatar as image type. I then go to the post and upload an image and save it. I have updated the blog.php with this code:
echo (get_post_meta($post->ID, ‘avatar’, true) != ”) ? ‘<div class=”avatar”><img fetchpriority=”high” decoding=”async” class=”round” <img src=”‘. get_post_meta($post->ID, ‘avatar’, true) . ‘”></div>’ : “”;
It returns an id number, not a reference to the image. How do I get it to return the image?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- You must be logged in to reply to this topic.