You will want to use add_image_size()
in your functions.php to tell WordPress you’d like it to create a new image size when you upload images:
1 |
add_image_size( 'custom_image_size_name', 290, 180, true ); |
Using the value true will tell WordPress you want it to crop the image to those exact dimensions.
Once you do that and upload an image, you can use custom_image_size_name
in wp_get_attachment_image()
to get the correct image.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.