I am new to wordpress and i want to use a size which can be 300 x 283, i tried the the_post_thumbnail(array('300,283'))
but it didn’t work, then i went to read about add_image_size
which i added like so add_image_size( 'homepage-thumb', 220, 180, true );
, gave my post_thumbnail same dimension but nothing happened, am i missing something? how to u my newly added add_image_size
in the_post_thumbnail
2 comments
Comments are closed.
By default WordPress has
threefour different image sizes: full, large, medium, thumbnail. If you don’t need more than three images size, you can set the with and height of the default image sizes. For example:Note: the dimensions for each default image size can be configured in the WordPress admin area. The above code will override this configuration.
If you need more than three image sizes, you want to have your very own image sizes or you don’t want to alter the default image sizes, you can add new image sizes using
add_image_size()
funciton:Once the new image size has been added, or the width/height of default sizes have been changed, the upcoming images will have a version with the new image size. The old images must be rebuild. To rebuild the old images you can upload them again or use a plugin, for example AJAX Thumbnail Rebuild. After that, you are ready to use the custom image size anywhere using, for example:
Check out the Codex a little deeper. The answer is there!