Reputation: 25
I want to show attached images inside the post .. Just like
<a href"LINK TO FULL SIZE IMAGE"><img src"LINK TO THUMB"></img></a>
I get the following from codex.wordpress but how to tell the code to use large image link with <href
and thumb link with <img
<?php
$attachment_id = 8; // attachment ID
$image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array
?>
<img src="<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">
Upvotes: 2
Views: 816
Reputation: 25322
You can use wp_get_attachment_link
instead of wp_get_attachment_image_src
:
echo wp_get_attachment_link($attachment_id, 'large');
Upvotes: 1