Answer the question
In order to leave comments, you need to log in
How to display an image in WordPress?
You need to display the image in the post using wp_get_attachment_image_src
Answer the question
In order to leave comments, you need to log in
Isn't it that difficult?
Go to Google, type in wp_get_attachment_image_src,
follow the first link to the code,
click on Examples -> Default Usage in the menu,
get
<?php
$attachment_id = 8; // attachment ID
$image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array
if( $image_attributes ) {
?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">
<?php } ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question