Getting specific image thumbnail urls of attached images

Have a look at wp_get_attachment_image_src

<?php 
$attachment_id = 8; // attachment ID

$image_attributes = wp_get_attachment_image_src( $attachment_id, 'medium' ); // returns an array
if( $image_attributes ) {
?> 
<img src="https://wordpress.stackexchange.com/questions/169475/<?php echo $image_attributes[0]; ?>" width="<?php echo $image_attributes[1]; ?>" height="<?php echo $image_attributes[2]; ?>">
<?php } ?>

Source: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src#Default_Usage

Leave a Comment

tech