Back to Top

How To create custom size thumbnail in WordPress

WordPress is the best solution for bloggers. You can easily post your content in WordPress with images.Almost every good blog post needs an image.An image will give the reader an instant idea of what the post is about and the image will draw the attention of readers as well. WordPress makes it easy to add an image to your post, control default image sizes, make minor edits to that image, and designate a featured image for your post.

Almost all WordPress themes support Post Thumbnails and You can use post thumbnails for your images, but sometimes you want to make changes in the thumbnail size as can’t use built in thumbnail functionality of WordPress.

Post Thumbnail or Featured image is a great option in WordPress to allow the user to .Here is a quick tutorial on how to get it to work within a theme.

Open theme functions.php file within the theme folder and add the following code :

if ( function_exists( 'add_image_size' ) ) {
	add_image_size( 'single-post-image', 75, 83, true );

Above line of code will create the different size of post thumbnail rather than default ones and the single-post-image argument specifies that to use the image size you defined rather than the default size of the image.

single-post-image creates thumb as 75px width and 83px height and you can specify any of the name and the sizes which fit with your theme.You can add multiple add_image_size functions and can create multiple thumbnails.The third parameter in add_image_size function is optional is “true” means to crop the image and save it as a separate image.You would like to read about how to Disable Post Revisions in WordPress.

To get it to display the custom image sizes so that you have to add following line of code within the loop into the pages. The function the_post_thumbnail is used to display thumbnail and argument will be the name that has been given within the function.

To add the featured image on your page, open file and add the following code within the loop:

if ( has_post_thumbnail() ) {
	the_post_thumbnail( 'single-post-image' );

That’s it. Now you can upload an image from admin panel of WordPress and its display image with.

I hope you have enjoyed this tutorial. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Have you tried above code in your theme? Do you have any query about custom thumbnail? Let me know via comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to Use Improved MySQLi in PHP

Posted on 7 years ago


How to use jQuery UI tabs in a WordPress?

Posted on 6 years ago


How dialog error message works in xCart?

Posted on 5 years ago


The Reader’s Poll – June 2015

Posted on 3 years ago


The Reader’s Poll – August 2014

Posted on 4 years ago


The Reader’s Poll – June 2014

Posted on 5 years ago


The Readers’ Poll – May 2014

Posted on 5 years ago


The Readers’ Poll – August 2013

Posted on 5 years ago