I am trying to add code for featured image on different resolution. like thumbnail, medium, large and full. But I wanna look like this type of resolution.
e.g
125x125
150x150.
250x250
I am trying this code. but it's not work.
<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,array(300,300), true);?>
<a href="<?php echo $thumb_url[0];?>" download="image-300x300" target="_blank">300x300</a>
</br>
It's show full size of image.
You need to add different image sizes in your
functions.php
file. WordPress will then create these resized images when a new image is created.Usage is as such:
Lots more information available on the WordPress Codex.
If you wish to create these image sizes retrospectively (to images you've already added) then you'll need to regenerate your thumbnails. You can do this using the regenerate thumbnails plugin.
You can then reference a image size in your code. A full example:
Inside
functions.php
:Inside your theme: