How to Add Custom Image Size in WordPress

 



Do you want to create additional image sizes in WordPress?

By default, WordPress automatically creates several copies of image uploads in different sizes. Additionally, WordPress themes and plugins can also create their own image sizes.

In this article, we’ll show you how to easily create additional image sizes in WordPress and use them on your website.

Why Create Additional Image Sizes in WordPress?

Normally, all popular WordPress themes and plugins handle image sizes very well. For instance, your WordPress theme may create additional sizes to use as thumbnails on archive pages.

However, sometimes these image sizes may not fit your own requirements. You may want to use a different image size in a child theme or a post grid layout.

You can do this by creating additional image sizes in WordPress and then calling these sizes whenever you need them.

That being said, let’s take a look at how to create additional image sizes in WordPress.

Registering Additional Image Sizes for your Theme

Most WordPress themes including all the top WordPress themes support post thumbnails (featured image) feature by default.

However, if you are creating a custom WordPress theme then you will need to add support for post thumbnails by adding the following code to your theme’s functions.php file.

add_theme_support( 'post-thumbnails' );

Once you enable the support for post thumbnails, you can now use the functionality of registering additional image sizes by using the function add_image_size().

The add_image_size function is used in the following format:

add_image_size( 'name-of-size', width, height, crop mode );

Example code can look like the following:


add_image_size( 'sidebar-thumb', 120, 120, true ); // Hard Crop Mode

add_image_size( 'homepage-thumb', 220, 180 ); // Soft Crop Mode

add_image_size( 'singlepost-thumb', 590, 9999 ); // Unlimited Height Mode

Now if you notice, we have specified three different sorts of image sizes. Each has different modes such as hard crop, soft crop, and unlimited height.

Let’s cover each example and how you can use them in your own projects.

Read Origianl Post How to Add Custom Image Size in WordPress
Continue Reading

---------------
Note: We want to improve our website's performance and usability so that you could really get a great benefit from our website. Just more one thing is that We publish all content only for testing purposes, not for commercial use, so if you have money then we fully recommend you to buy the required plugin/theme, etc from the original developer's website. Use any theme OR plugin on your own risk! We only share files under the terms of GPL Licence (GNU General Public License) that provides professional themes, premium plugins and other PHP scripts for testing purpose only. What is the GPL Licence?
JOIN OUR NEWSLETTER

Every Latest Updates will Delivery Straight to Your Mail Box

Show Comments
Digital Marketing:$9.99
Complete Premium Book(new) Additional SEO Ebook Learn to live Use For Advanced Satisfaction Guaranteed
Buy Now
Free Download Get this Tutorial for FREE with No Encrypted Scripts but No Support Included.