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?
- 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
- 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
- How to upload imagick resource to media in wordpress
- How wordpress handle upload images and how to use them in the code
- 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
- 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
- Featured Images are not able to be set
- Why an arugment is missing in wp_get_attachment_image_attributes?
- 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
- Responsive Images – crop don’t seem to work
- 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
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- Redirect to another page using contact form 7? [closed]
- Getting Different Size Of Attachment Images
- Remove Featured Image & All Media Uploaded to the 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
- 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
- Callback Function Not Firing On Selection In Media Uploader
- Full width featured thumbnail
- Set Featured Image not opening – Stuck at loading
- How can I get the featured image or the first image for a post/page and display it as a banner?
- Stop WordPress from showing images on non post pages
- How to add cropped custom header image?
- Is there a way to serve different resolution images to different devices?
- Theming media inserts
- Dynamic Image Links Depending on Excerpt/’Single Post’ View
- ACF get_sub_field ALT TAG in the repeater doesn’t show
- Post Featured Image Custom Sizing?
- Image cropping isn’t working correctly when using Offload Media
- How to add an image to a theme page template in code?
- Created blank theme for REST API, featured image not appearing on admin side
- How to make the media library searchable by image title
- Responsive Images with art direction
- Customizer Image-Picker Preview Not Working
- Can’t upload images on new theme
- How to load mediaelement.js in theme template?
- image sizes – finding and removing
- Newly uploaded images are not updating in featured image
- Full width thumbnail
- Adding a Class to an Getting From Post Content
- Featured Image Module Randomly Disappears
- How would I get this to work – send to post from thick box
- Single Featured Image Repeating
- How do I keep images in posts below a certain size without editing the post?
- the_post_thumbnail fetches wrong image
- apply_filters to featured image
- Show post thumbnail only if it exists using timthumb
- WP is showing wrong image dimensions
- How can I add a single image from a gallery into the page header?
- Isotope overlapping .items because of featured images – HELP! [closed]
- Why some images are not allowed to be edited only for thumbnails?
- How to import external media items into wordpress media library (without using storage)
- Custom Theme functions.php – Using add_settings_field and input type=”file” to set custom logo
- How do I work with responsive images in WordPress? (img srcset/sizes)