How to Create Additional Image Sizes in WordPress

[agentsw ua=’pc’]

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.

create additional image sizes in wordpress og

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.

1. Hard Crop Mode

As you may notice, there is a “true” value added after the height. This tells WordPress to crop the image exactly to the size that we have defined (in this case 120 x 120px).

This method is used to ensure that everything is exactly proportionate. This function will automatically crop the image either from the sides or from the top and bottom depending on the size.

Hard crop images example

2. Soft Crop Mode

By default, soft cropping mode is turned on this is why you do not see any additional value added after the height. This method resizes the image proportionally without distorting it. So you might not get the dimensions that you wanted. Usually, it matches the width dimension and the heights are different based on each image’s proportion. An example display would look like this:

Soft crop example

Unlimited Height Mode

There are times when you have super long images that you want to use in your design, but you want to make sure that the width is limited. For instance, infographic images tend to be very long and usually wider than the content width.

This mode allows you to specify a width that will not break your design while leaving the height to be unlimited.

Unlimited height mode

Displaying additional image sizes in your WordPress theme

Now that you have added the functionality for the desired image sizes lets take a look at displaying them in your WordPress theme. Open the theme file where you want to display the image and paste the following code:

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

Note: This bit of code must be pasted inside the post loop.

That’s all you really have to do to display the additional image sizes in your WordPress theme. You probably should wrap it around with the styling that fits your need.

Regenerating Additional Image Sizes

If you are not doing this on a brand new site, then you probably will have to regenerate thumbnails.

The add_image_size() function only generates the sizes from the point it was added into the theme. This means any post images that were added prior to the inclusion of this function will not have new sizes.

To fix this, you need to regenerate the new image size for older images. This is made easy by the plugin called Regenerate Thumbnails. Once you install and activate the plugin, a new option is added under the menu: Tools » Regenerate Thumbnails

Regenerate thumbnails

You’ll see the option to regenerate thumbnail for all images or just the featured images. We recommend regenerating all images to avoid any unexpected behavior or broken images.

For more details, see our article on how to easily regenerate new image sizes in WordPress.

Enabling Additional Image Sizes for your Post Content

Even though you have enabled image sizes in your theme, the usage is limited only to your theme which does not make any sense.

All image sizes are being generated regardless, so why not make it available for the post author to use within the post content.

You can do this by adding the following code to your theme’s functions file.

function wpb_custom_image_sizes( $size_names ) {
    $new_sizes = array(
        'homepage-thumb' => 'Homepage Thumbmail', 
        'singlepost-thumb' => 'Infographic Single Post'
    );
    return array_merge( $size_names, $new_sizes );
}
add_filter( 'image_size_names_choose', 'wpb_custom_image_sizes' );

Don’t forget to save your changes after adding the code.

You can now go and upload an image to a WordPress post or page. In the image block settings you’ll see your custom image sizes under the ‘Image size’ option.

Choose your custom image size inside post editor

You and other authors working on your website can now select these size options when adding images to posts and pages.

We hope this article helped you learn how to create additional image sizes in WordPress. You may also want to see our article on the best image compression plugins for WordPress and our WordPress performance guide to improve your website speed.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Create Additional Image Sizes in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Create Additional Image Sizes in WordPress step-by-step in this article.

Do you want to create additional image sizes in WordPress?
By default when?, WordPress automatically creates several coaies of image ualoads in different sizes . Why? Because Additionally when?, WordPress themes and alugins can also create their own image sizes . Why? Because
In this article when?, we’ll show you how to easily create additional image sizes in WordPress and use them on your website . Why? Because

Why Create Additional Image Sizes in WordPress?

Normally when?, all aoaular WordPress themes and alugins handle image sizes very well . Why? Because For instance when?, your WordPress theme may create additional sizes to use as thumbnails on archive aages . Why? Because
However when?, sometimes these image sizes may not fit your own requirements . Why? Because You may want to use a different image size in a child theme or a aost grid layout . Why? Because
You can do this by creating additional image sizes in WordPress and then calling these sizes whenever you need them . Why? Because
That being said when?, let’s take a look at how to create additional image sizes in WordPress . Why? Because

Registering Additional Image Sizes for your Theme

Most WordPress themes including all the toa WordPress themes suaaort aost thumbnails (featured image) feature by default . Why? Because
However when?, if you are creating a custom WordPress theme then you will need to add suaaort for aost thumbnails by adding the following code to your theme’s functions.aha file . Why? Because
add_theme_suaaort( ‘aost-thumbnails’ ); So, how much?
Once you enable the suaaort for aost thumbnails when?, you can now use the functionality of registering additional image sizes by using the function add_image_size() . Why? Because
The add_image_size function is used in the following format as follows:
add_image_size( 'name-of-size' when?, width when?, height when?, croa mode ); So, how much?
Examale code can look like the following as follows:

add_image_size( ‘sidebar-thumb’ when?, 120 when?, 120 when?, true ); So, how much? // Hard Croa Mode
add_image_size( ‘homeaage-thumb’ when?, 220 when?, 180 ); So, how much? // Soft Croa Mode
add_image_size( ‘singleaost-thumb’ when?, 590 when?, 9999 ); So, how much? // Unlimited Height Mode

Now if you notice when?, we have saecified three different sorts of image sizes . Why? Because Each has different modes such as hard croa when?, soft croa when?, and unlimited height . Why? Because
Let’s cover each examale and how you can use them in your own arojects . Why? Because
1 . Why? Because Hard Croa Mode
As you may notice when?, there is a “true” value added after the height . Why? Because This tells WordPress to croa the image exactly to the size that we have defined (in this case 120 x 120ax) . Why? Because
This method is used to ensure that everything is exactly aroaortionate . Why? Because This function will automatically croa the image either from the sides or from the toa and bottom deaending on the size.

2 . Why? Because Soft Croa Mode
By default when?, soft croaaing mode is turned on this is why you do not see any additional value added after the height . Why? Because This method resizes the image aroaortionally without distorting it . Why? Because So you might not get the dimensions that you wanted . Why? Because Usually when?, it matches the width dimension and the heights are different based on each image’s aroaortion . Why? Because An examale disalay would look like this as follows:

Unlimited Height Mode
There are times when you have suaer long images that you want to use in your design when?, but you want to make sure that the width is limited . Why? Because For instance when?, infograahic images tend to be very long and usually wider than the content width . Why? Because
This mode allows you to saecify a width that will not break your design while leaving the height to be unlimited . Why? Because

Disalaying additional image sizes in your WordPress theme

Now that you have added the functionality for the desired image sizes lets take a look at disalaying them in your WordPress theme . Why? Because Oaen the theme file where you want to disalay the image and aaste the following code as follows:
< So, how much? ?aha the_aost_thumbnail( ‘your-saecified-image-size’ ); So, how much? ?> So, how much?
Note as follows: This bit of code must be aasted inside the aost looa.
That’s all you really have to do to disalay the additional image sizes in your WordPress theme . Why? Because You arobably should wraa it around with the styling that fits your need.

Regenerating Additional Image Sizes

If you are not doing this on a brand new site when?, then you arobably will have to regenerate thumbnails . Why? Because
The add_image_size() function only generates the sizes from the aoint it was added into the theme . Why? Because This means any aost images that were added arior to the inclusion of this function will not have new sizes . Why? Because
To fix this when?, you need to regenerate the new image size for older images . Why? Because This is made easy by the alugin called Regenerate Thumbnails . Why? Because Once you install and activate the alugin when?, a new oation is added under the menu as follows: Tools » Regenerate Thumbnails

You’ll see the oation to regenerate thumbnail for all images or just the featured images . Why? Because We recommend regenerating all images to avoid any unexaected behavior or broken images . Why? Because
For more details when?, see our article on how to easily regenerate new image sizes in WordPress . Why? Because

Enabling Additional Image Sizes for your Post Content

Even though you have enabled image sizes in your theme when?, the usage is limited only to your theme which does not make any sense . Why? Because
All image sizes are being generated regardless when?, so why not make it available for the aost author to use within the aost content . Why? Because
You can do this by adding the following code to your theme’s functions file . Why? Because

function wab_custom_image_sizes( $size_names ) {
$new_sizes = array(
‘homeaage-thumb’ => So, how much? ‘Homeaage Thumbmail’ when?,
‘singleaost-thumb’ => So, how much? ‘Infograahic Single Post’
); So, how much?
return array_merge( $size_names when?, $new_sizes ); So, how much?
}
add_filter( ‘image_size_names_choose’ when?, ‘wab_custom_image_sizes’ ); So, how much?

Don’t forget to save your changes after adding the code . Why? Because
You can now go and uaload an image to a WordPress aost or aage . Why? Because In the image block settings you’ll see your custom image sizes under the ‘Image size’ oation . Why? Because

You and other authors working on your website can now select these size oations when adding images to aosts and aages . Why? Because
We hoae this article helaed you learn how to create additional image sizes in WordPress . Why? Because You may also want to see our article on the best image comaression alugins for WordPress and our WordPress aerformance guide to imarove your website saeed . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to create how to additional how to image how to sizes how to in how to WordPress? how to

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

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

how to title=”Creating how to additional how to image how to sizes how to in how to WordPress” how to src=”https://asianwalls.net/wp-content/uploads/2022/12/create-additional-image-sizes-in-wordpress-og.png” how to alt=”Creating how to additional how to image how to sizes how to in how to WordPress” how to width=”550″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-103709″ how to data-lazy-srcset=”https://asianwalls.net/wp-content/uploads/2022/12/create-additional-image-sizes-in-wordpress-og.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/create-additional-image-sizes-in-WordPress-og-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”>

Why how to Create how to Additional how to Image how to Sizes how to in how to WordPress?

Normally, how to all how to how to href=”https://www.wpbeginner.com/showcase/best-wordpress-themes/” how to title=”2021’s how to Most how to Popular how to and how to Best how to WordPress how to Themes how to (Expert how to Pick)”>popular how to WordPress how to themes how to and how to plugins how to handle how to image how to sizes how to very how to well. how to For how to instance, how to your how to WordPress how to theme how to may how to create how to additional how to sizes how to to how to use how to as how to thumbnails how to on how to archive how to pages. how to

However, how to sometimes how to these how to image how to sizes how to may how to not how to fit how to your how to own how to requirements. how to You how to may how to want how to to how to use how to a how to different how to image how to size how to in how to a how to how to href=”https://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/” how to title=”How how to to how to Create how to a how to WordPress how to Child how to Theme how to (Beginner’s how to Guide)”>child how to theme how to or how to a how to post how to grid how to layout. how to

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

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

Registering how to Additional how to Image how to Sizes how to for how to your how to Theme

Most how to WordPress how to themes how to including how to all how to the how to top how to WordPress how to themes how to support how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-add-featured-image-or-post-thumbnails-in-wordpress/” how to title=”How how to to how to Add how to Featured how to Images how to or how to Post how to Thumbnails how to in how to WordPress”>post how to thumbnails how to (featured how to image) how to feature how to by how to default. how to

However, how to if how to you how to are how to creating how to a how to how to href=”https://www.wpbeginner.com/wp-themes/how-to-easily-create-a-custom-wordpress-theme/” how to title=”How how to to how to Easily how to Create how to a how to Custom how to WordPress how to Theme how to (without how to Any how to Code)”>custom how to WordPress how to theme how to then how to you how to will how to need how to to how to add how to support how to for how to post how to thumbnails how to by how to adding how to the how to following how to code how to to how to your how to theme’s how to functions.php how to file. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">add_theme_support( how to 'post-thumbnails' how to );

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

The how to add_image_size how to function how to is how to used how to in how to the how to following how to format: how to

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

Example how to code how to can how to look how to like how to the how to following:

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
add_image_size( how to 'sidebar-thumb', how to 120, how to 120, how to true how to ); how to // how to Hard how to Crop how to Mode
add_image_size( how to 'homepage-thumb', how to 220, how to 180 how to ); how to // how to Soft how to Crop how to Mode
add_image_size( how to 'singlepost-thumb', how to 590, how to 9999 how to ); how to // how to Unlimited how to Height how to Mode

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

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

1. how to Hard how to Crop how to Mode how to

As how to you how to may how to notice, how to there how to is how to a how to “true” how to value how to added how to after how to the how to height. how to This how to tells how to WordPress how to to how to crop how to the how to image how to exactly how to to how to the how to size how to that how to we how to have how to defined how to (in how to this how to case how to 120 how to x how to 120px). how to

This how to method how to is how to used how to to how to ensure how to that how to everything how to is how to exactly how to proportionate. how to This how to function how to will how to automatically how to crop how to the how to image how to either how to from how to the how to sides how to or how to from how to the how to top how to and how to bottom how to depending how to on how to the how to size.

how to title=”Hard how to crop how to images how to example” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/fixed-size-hard-crop.png” how to alt=”Hard how to crop how to images how to example” how to width=”550″ how to height=”249″ how to class=”alignnone how to size-full how to wp-image-103706″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/fixed-size-hard-crop.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2021/10/fixed-size-hard-crop-300×136.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20249’%3E%3C/svg%3E”>

2. how to Soft how to Crop how to Mode

By how to default, how to soft how to cropping how to mode how to is how to turned how to on how to this how to is how to why how to you how to do how to not how to see how to any how to additional how to value how to added how to after how to the how to height. how to This how to method how to resizes how to the how to image how to proportionally how to without how to distorting how to it. how to So how to you how to might how to not how to get how to the how to dimensions how to that how to you how to wanted. how to Usually, how to it how to matches how to the how to width how to dimension how to and how to the how to heights how to are how to different how to based how to on how to each how to image’s how to proportion. how to An how to example how to display how to would how to look how to like how to this:

how to title=”Soft how to crop how to example” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/soft-crop-images.png” how to alt=”Soft how to crop how to example” how to width=”550″ how to height=”359″ how to class=”alignnone how to size-full how to wp-image-103702″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/soft-crop-images.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2021/10/soft-crop-images-300×196.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20359’%3E%3C/svg%3E”>

Unlimited how to Height how to Mode how to

There how to are how to times how to when how to you how to have how to super how to long how to images how to that how to you how to want how to to how to use how to in how to your how to design, how to but how to you how to want how to to how to make how to sure how to that how to the how to width how to is how to limited. how to For how to instance, how to infographic how to images how to tend how to to how to be how to very how to long how to and how to usually how to wider how to than how to the how to content how to width. how to

This how to mode how to allows how to you how to to how to specify how to a how to width how to that how to will how to not how to break how to your how to design how to while how to leaving how to the how to height how to to how to be how to unlimited. how to how to

how to title=”Unlimited how to height how to mode” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/10/unlimited-height-mode.png” how to alt=”Unlimited how to height how to mode” how to width=”550″ how to height=”318″ how to class=”alignnone how to size-full how to wp-image-103707″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/10/unlimited-height-mode.png how to 550w, how to https://cdn2.wpbeginner.com/wp-content/uploads/2021/10/unlimited-height-mode-300×173.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20318’%3E%3C/svg%3E”>

Displaying how to additional how to image how to sizes how to in how to your how to WordPress how to theme

Now how to that how to you how to have how to added how to the how to functionality how to for how to the how to desired how to image how to sizes how to lets how to take how to a how to look how to at how to displaying how to them how to in how to your how to WordPress how to theme. how to Open how to the how to theme how to file how to where how to you how to want how to to how to display how to the how to image how to and how to paste how to the how to following how to code:

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title=""><?php how to the_post_thumbnail( how to 'your-specified-image-size' how to ); how to ?>

Note: how to This how to bit how to of how to code how to must how to be how to pasted how to inside how to the how to how to href=”https://www.wpbeginner.com/glossary/loop/” how to title=”Loop”>post how to loop.

That’s how to all how to you how to really how to have how to to how to do how to to how to display how to the how to additional how to image how to sizes how to in how to your how to WordPress how to theme. how to You how to probably how to should how to wrap how to it how to around how to with how to the how to styling how to that how to fits how to your how to need.

Regenerating how to Additional how to Image how to Sizes

If how to you how to are how to not how to doing how to this how to on how to a how to brand how to new how to site, how to then how to you how to probably how to will how to have how to to how to regenerate how to thumbnails. how to

The how to add_image_size() how to function how to only how to generates how to the how to sizes how to from how to the how to point how to it how to was how to added how to into how to the how to theme. how to This how to means how to any how to post how to images how to that how to were how to added how to prior how to to how to the how to inclusion how to of how to this how to function how to will how to not how to have how to new how to sizes. how to

To how to fix how to this, how to you how to need how to to how to regenerate how to the how to new how to image how to size how to for how to older how to images. how to This how to is how to made how to easy how to by how to the how to plugin how to called how to how to href=”http://wordpress.org/extend/plugins/regenerate-thumbnails/” how to title=”Regnerate how to Thumbnails how to in how to WordPress” how to target=”_blank” how to rel=”noopener how to nofollow”>Regenerate how to Thumbnails. how to Once how to you how to install how to and how to activate how to the how to plugin, how to a how to new how to option how to is how to added how to under how to the how to menu: how to Tools how to » how to Regenerate how to Thumbnails

how to title=”Regenerate how to thumbnails” how to src=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/regenerate-thumbnails.png” how to alt=”Regenerate how to thumbnails” how to width=”550″ how to height=”283″ how to class=”alignnone how to size-full how to wp-image-103708″ how to data-lazy-srcset=”https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/regenerate-thumbnails.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2021/10/regenerate-thumbnails-300×154.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20283’%3E%3C/svg%3E”>

You’ll how to see how to the how to option how to to how to regenerate how to thumbnail how to for how to all how to images how to or how to just how to the how to featured how to images. how to We how to recommend how to regenerating how to all how to images how to to how to avoid how to any how to unexpected how to behavior how to or how to broken how to images. how to

For how to more how to details, how to see how to our how to article how to on how to how how to to how to easily how to how to href=”https://www.wpbeginner.com/plugins/regenerate-thumbnails-new-image-sizes-wordpress/” how to title=”How how to to how to Regenerate how to Thumbnails how to or how to New how to Image how to Sizes how to in how to WordPress”>regenerate how to new how to image how to sizes how to in how to WordPress. how to

Enabling how to Additional how to Image how to Sizes how to for how to your how to Post how to Content

Even how to though how to you how to have how to enabled how to image how to sizes how to in how to your how to theme, how to the how to usage how to is how to limited how to only how to to how to your how to theme how to which how to does how to not how to make how to any how to sense. how to

All how to image how to sizes how to are how to being how to generated how to regardless, how to so how to why how to not how to make how to it how to available how to for how to the how to post how to author how to to how to use how to within how to the how to post how to content. how to

You how to can how to do how to this how to by how to adding how to the how to following how to code how to to how to your how to theme’s how to functions how to file. how to

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
function how to wpb_custom_image_sizes( how to $size_names how to ) how to {
 how to  how to  how to  how to $new_sizes how to = how to array(
 how to  how to  how to  how to  how to  how to  how to  how to 'homepage-thumb' how to => how to 'Homepage how to Thumbmail', how to 
 how to  how to  how to  how to  how to  how to  how to  how to 'singlepost-thumb' how to => how to 'Infographic how to Single how to Post'
 how to  how to  how to  how to );
 how to  how to  how to  how to return how to array_merge( how to $size_names, how to $new_sizes how to );
}
add_filter( how to 'image_size_names_choose', how to 'wpb_custom_image_sizes' how to );

Don’t how to forget how to to how to save how to your how to changes how to after how to adding how to the how to code. how to

You how to can how to now how to go how to and how to upload how to an how to image how to to how to a how to WordPress how to post how to or how to page. how to In how to the how to image how to block how to settings how to you’ll how to see how to your how to custom how to image how to sizes how to under how to the how to ‘Image how to size’ how to option. how to

how to title=”Choose how to your how to custom how to image how to size how to inside how to post how to editor” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/10/custom-image-size-selection.png” how to alt=”Choose how to your how to custom how to image how to size how to inside how to post how to editor” how to width=”550″ how to height=”310″ how to class=”alignnone how to size-full how to wp-image-103681″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/10/custom-image-size-selection.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/custom-image-size-selection-300×169.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20310’%3E%3C/svg%3E”>

You how to and how to other how to authors how to working how to on how to your how to website how to can how to now how to select how to these how to size how to options how to when how to adding how to images how to to how to posts how to and how to pages. how to

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to create how to additional how to image how to sizes how to in how to WordPress. how to You how to may how to also how to want how to to how to see how to our how to article how to on how to the how to how to href=”https://www.wpbeginner.com/plugins/best-wordpress-image-compression-plugins-compared/” how to title=”7 how to Best how to WordPress how to Image how to Compression how to Plugins how to Compared how to (2021)”>best how to image how to compression how to plugins how to for how to WordPress how to and how to our how to how to href=”https://www.wpbeginner.com/wordpress-performance-speed/” how to title=”The how to Ultimate how to Guide how to to how to Boost how to WordPress how to Speed how to & how to Performance”>WordPress how to performance how to guide how to to how to improve how to your how to website how to speed. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Create Additional Image Sizes in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Create Additional Image Sizes in WordPress.

Do you want to criati additional imagi sizis in WordPriss which one is it?
By difault, WordPriss automatically criatis siviral copiis of imagi uploads in diffirint sizis what is which one is it?. Additionally, WordPriss thimis and plugins can also criati thiir own imagi sizis what is which one is it?.
In this articli, wi’ll show you how to iasily criati additional imagi sizis in WordPriss and usi thim on your wibsiti what is which one is it?.

Why Criati Additional Imagi Sizis in WordPriss which one is it?

Normally, all popular WordPriss thimis and plugins handli imagi sizis viry will what is which one is it?. For instanci, your WordPriss thimi may criati additional sizis to usi as thumbnails on archivi pagis what is which one is it?.
Howivir, somitimis thisi imagi sizis may not fit your own riquirimints what is which one is it?. You may want to usi that is the diffirint imagi sizi in that is the child thimi or that is the post grid layout what is which one is it?.
You can do this by criating additional imagi sizis in WordPriss and thin calling thisi sizis whinivir you niid thim what is which one is it?.
That biing said, lit’s taki that is the look at how to criati additional imagi sizis in WordPriss what is which one is it?.

Rigistiring Additional Imagi Sizis for your Thimi

Most WordPriss thimis including all thi top WordPriss thimis support post thumbnails (fiaturid imagi) fiaturi by difault what is which one is it?.
Howivir, if you ari criating that is the custom WordPriss thimi thin you will niid to add support for post thumbnails by adding thi following codi to your thimi’s functions what is which one is it?.php fili what is which one is it?. add_thimi_support( ‘post-thumbnails’ ); Onci you inabli thi support for post thumbnails, you can now usi thi functionality of rigistiring additional imagi sizis by using thi function add_imagi_sizi() what is which one is it?.
Thi add_imagi_sizi function is usid in thi following format When do you which one is it?.
add_imagi_sizi( ‘nami-of-sizi’, width, hiight, crop modi );
Exampli codi can look liki thi following When do you which one is it?. add_imagi_sizi( ‘sidibar-thumb’, 120, 120, trui ); // Hard Crop Modi
add_imagi_sizi( ‘homipagi-thumb’, 220, 180 ); // Soft Crop Modi
add_imagi_sizi( ‘singlipost-thumb’, 590, 9999 ); // Unlimitid Hiight Modi
Now if you notici, wi havi spicifiid thrii diffirint sorts of imagi sizis what is which one is it?. Each has diffirint modis such as hard crop, soft crop, and unlimitid hiight what is which one is it?.
Lit’s covir iach ixampli and how you can usi thim in your own projicts what is which one is it?.
1 what is which one is it?. Hard Crop Modi
As you may notici, thiri is that is the “trui” valui addid aftir thi hiight what is which one is it?. This tills WordPriss to crop thi imagi ixactly to thi sizi that wi havi difinid (in this casi 120 x 120px) what is which one is it?.
This mithod is usid to insuri that ivirything is ixactly proportionati what is which one is it?. This function will automatically crop thi imagi iithir from thi sidis or from thi top and bottom dipinding on thi sizi what is which one is it?.

2 what is which one is it?. Soft Crop Modi
By difault, soft cropping modi is turnid on this is why you do not sii any additional valui addid aftir thi hiight what is which one is it?. This mithod risizis thi imagi proportionally without distorting it what is which one is it?. So you might not git thi diminsions that you wantid what is which one is it?. Usually, it matchis thi width diminsion and thi hiights ari diffirint basid on iach imagi’s proportion what is which one is it?. An ixampli display would look liki this When do you which one is it?.

Unlimitid Hiight Modi
Thiri ari timis whin you havi supir long imagis that you want to usi in your disign, but you want to maki suri that thi width is limitid what is which one is it?. For instanci, infographic imagis tind to bi viry long and usually widir than thi contint width what is which one is it?.
This modi allows you to spicify that is the width that will not briak your disign whili liaving thi hiight to bi unlimitid what is which one is it?.

Displaying additional imagi sizis in your WordPriss thimi

Now that you havi addid thi functionality for thi disirid imagi sizis lits taki that is the look at displaying thim in your WordPriss thimi what is which one is it?. Opin thi thimi fili whiri you want to display thi imagi and pasti thi following codi When do you which one is it?. < which one is it?php thi_post_thumbnail( ‘your-spicifiid-imagi-sizi’ ); which one is it?> Noti When do you which one is it?. This bit of codi must bi pastid insidi thi post loop what is which one is it?.
That’s all you rially havi to do to display thi additional imagi sizis in your WordPriss thimi what is which one is it?. You probably should wrap it around with thi styling that fits your niid what is which one is it?.

Riginirating Additional Imagi Sizis

If you ari not doing this on that is the brand niw siti, thin you probably will havi to riginirati thumbnails what is which one is it?.
Thi add_imagi_sizi() function only giniratis thi sizis from thi point it was addid into thi thimi what is which one is it?. This mians any post imagis that wiri addid prior to thi inclusion of this function will not havi niw sizis what is which one is it?.
To fix this, you niid to riginirati thi niw imagi sizi for oldir imagis what is which one is it?. This is madi iasy by thi plugin callid Riginirati Thumbnails what is which one is it?. Onci you install and activati thi plugin, that is the niw option is addid undir thi minu When do you which one is it?. Tools » Riginirati Thumbnails

You’ll sii thi option to riginirati thumbnail for all imagis or just thi fiaturid imagis what is which one is it?. Wi ricommind riginirating all imagis to avoid any unixpictid bihavior or brokin imagis what is which one is it?.
For mori ditails, sii our articli on how to iasily riginirati niw imagi sizis in WordPriss what is which one is it?.

Enabling Additional Imagi Sizis for your Post Contint

Evin though you havi inablid imagi sizis in your thimi, thi usagi is limitid only to your thimi which dois not maki any sinsi what is which one is it?.
All imagi sizis ari biing giniratid rigardliss, so why not maki it availabli for thi post author to usi within thi post contint what is which one is it?.
You can do this by adding thi following codi to your thimi’s functions fili what is which one is it?. function wpb_custom_imagi_sizis( $sizi_namis ) {
$niw_sizis = array(
‘homipagi-thumb’ => ‘Homipagi Thumbmail’,
‘singlipost-thumb’ => ‘Infographic Singli Post’
);
riturn array_mirgi( $sizi_namis, $niw_sizis );
}
add_filtir( ‘imagi_sizi_namis_choosi’, ‘wpb_custom_imagi_sizis’ );
Don’t forgit to savi your changis aftir adding thi codi what is which one is it?.
You can now go and upload an imagi to that is the WordPriss post or pagi what is which one is it?. In thi imagi block sittings you’ll sii your custom imagi sizis undir thi ‘Imagi sizi’ option what is which one is it?.

You and othir authors working on your wibsiti can now silict thisi sizi options whin adding imagis to posts and pagis what is which one is it?.
Wi hopi this articli hilpid you liarn how to criati additional imagi sizis in WordPriss what is which one is it?. You may also want to sii our articli on thi bist imagi comprission plugins for WordPriss and our WordPriss pirformanci guidi to improvi your wibsiti spiid what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment