You can use add_image_size() function to create custom sized images. You only need to paste some piece of codes in your functions.php and then update the template files accordingly.
For example :
add_image_size( 'category-thumb', 300 ); // 300 pixels wide (and unlimited height)
add_image_size( 'homepage-thumb', 220, 180, true ); // (cropped)
And you can use below codes to load those images in your template.
the_post_thumbnail( 'category-thumb' );
the_post_thumbnail( 'homepage-thumb' );
Hope this helps. See this page for more info.
Related Posts:
- The the_post_thumbnail without srcset?
- Get the first image from post content (eg.: hotlinked images)
- Unexpected width and srcset attributes for the_post_thumbnail();
- How to set dimensions of the post thumbnails (featured images)
- Cannot get full thumbnail size using the_post_thumbnail
- Reasons why all thumbnail sizes aren’t working
- How do I Add images uploaded in the post to a default custom field
- WordPress Media Uploader in page template (On Front-end)
- In creating a theme, how can i allow a user to change an image outside post/page content?
- How to disable thumbnail filter for a specific template part or image size?
- WordPress creating images if uploaded image is greater than 960px on one side?
- How to make excerpt image be full size instead of thumbnail?
- How can I scale down the width of images in bulk that are embedded in posts throughout the site?
- Add image URL automatically to custom field?
- theme directory fallback image outputs url and not the image
- Any disadvandages if I style the wordpress align classes without img and .wp-caption prefix
- I want to resize post featured image without cropping image. How?
- Convert base64 string to WordPress attachment uploads multiple images instead of a single one
- WP “optimizing” PNGs into thumbnails 5X larger than originals – FIX
- optimized PNGs 5X larger than originals
- WordPress Theme Preview Image
- How to modify an image block in Gutenberg WordPress 5?
- How can I set image sizes and still have responsive images using the srcset attribute?
- Add default Backgrounds
- Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks
- How to add a 2nd “featured image” to a post?
- Possible to “Attach” images to multiple posts without inserting or uploading twice?
- get_attached_media() returns empty array if media file already used by another post
- wp_get_attachment_image_attributes not working for me
- Specify image dimensions
- How to get gallery images?
- How to change the naming of the resized image files
- How to change post thumbnail title and alt attributes to post title?
- add_image_size is scaling, even though crop is set to true
- Featured Image in 4.4 should be larger on mobile device
- How to use the responsive images feature from WP 4.4 in your themes
- Confused about image sizing business in WordPress
- How do I get gallery thumbnail URL and change the default thumbnail size?
- How to upload imagick resource to media in wordpress
- Responsive class to all the images in the content
- How wordpress handle upload images and how to use them in the code
- How to handle thumbnails
- Replace Home with image link inside custom header menu
- Featured Image Size
- How do I get images (with a thumbnail preview) to show in search results?
- Change display of featured image for pages in twenty seventeen theme
- How to regenerate thumbnails when they’re stored on S3
- How to manipulate “add media” pop-up
- wp_get_attachment_image_src() width and height boolean
- Thumbnails are bigger in size than the original image
- How to float an image in Gutenberg
- A mystery 300px image size
- Can’t show custom post thumbnail sizes as background images
- Custom Field returning Numerical Value for Image rather than URL
- Attach media to multiple posts
- Featured Images are not able to be set
- Why an arugment is missing in wp_get_attachment_image_attributes?
- Display recent posts with thumbnail
- How to make a local cache of mshots images
- Errors when uploading images in WP 3.5
- attachment.php code or tutorial
- Change “Thumbnail”, “Medium” and “Large” image sizes using functions.php?
- image url relative path not working in css file
- Default image size not working
- How do I build a post_thumbnail based archive? [closed]
- Set spesific size of featured images
- Responsive Images – crop don’t seem to work
- How do I include pre-installed images in a theme?
- Export xml use/import images from theme directory
- How do I turn a post thumbnail into a background image?
- Reactor Theme: Prevent Post Thumb on Post
- Inserting images in multiple posts native gallery
- Can I get the ID of an inserted / linked image?
- Add attachment for all images in post
- Changing Header Image Every N Minutes/Seconds
- Do not display post images on front page
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Redirect to another page using contact form 7? [closed]
- Gallery thumbnails very small
- Featured Image meta box not showing up
- How do I remove inline style in featured image markup?
- Custom image size vs CSS sizing
- Getting Different Size Of Attachment Images
- Remove Featured Image & All Media Uploaded to the Post
- Change Responsive Images Maximum Width of 1600px
- Set a featured image as a replacement to the header image
- Dynamic Post Thumbnail →
- How to show a manageable list of images on a post?
- Issue on Getting Custom post type Thumbnail’s URL
- Change image size depending on page
- How to obfuscate theme directory URLs
- the_post_thumbnail() get the URL to the “medium” sized image
- Are seven additional image sizes are too many?
- Remove link on full-size images
- wp.media issue with selected image
- how to retrieve the image title for image Post Format
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Theme logo metadata into template file
- Get featured image with custom size outside WordPress
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?