Post On : January 21, 2020

Some time we have facing issue with images size

Here we are talking about custom images which you want

You can create your custom size using wordpres function

First register image size using below function

Below is some of the example

add_image_size( 'custom_thumb', 120, 120, true ); // Hard Crop Mode
add_image_size( 'postpage_thumb', 220, 180 ); 
add_image_size( 'singlepost_thumb', 590, 9999 ); 

You can see the first example I have added true after the height.

True value means crop the our images size and get the current 120X120 size image

After you can echo your images in your template files like below code

<?php the_post_thumbnail( 'your-specified-image-size' ); ?>

Here we need to change function name ‘your-specified-image-size’ to our function like ‘custom_thumb’, ‘postpage_thumb’, ‘singlepost_thumb’ etc

I hope this article will help you 🙂

Catagory :Blog, Wordpress