To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won’t be a srcset.
You might find my answer here helpful.
Briefly, in your case, adding this line:
add_image_size ( 'double-size', 1270, 400, true );
… will make a srcset with both the cropped sizes when you upload a fresh image larger than 1270×400.
Related Posts:
- Is there a hook which fires after all thumbnails are generated?
- get_the_post_thumbnail_url with an unregistered size
- Cropped featured image replaces original image in gallery
- Removing Title Tag from Thumbnails
- Disable wordpress image sizes generation
- Lazyload post thumbnails
- How to stop thumbnail generation from some images and different size thumbnail generate
- Update old Post image metadata to ‘thumbnail’ wp_attached_file
- How to stop wordpress always displaying full-res images
- Fixing image names for a site being restored
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Can we use featured image as third party website image URL
- add_image_size not working
- Product Images Low Quality After Updating From WP 3.5 to 4 [closed]
- adding image to post thumbnail from another server
- How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?
- How to use default image as featured image by implement some code in function.php
- WordPress Multisite: Images moved to /sites/1?
- I cannot upload images to post or the media library in wordpress
- Why image Thumbnail url is not displaying with custom size?
- Making a thumbnail if there exist a link with. jpg or .png extension in WordPress
- WP is showing wrong image dimensions
- Filter to remove image dimension attributes?
- How to disable WordPress from creating thumbnails?
- Stop wordpress from hardcoding img width and height attributes
- Programmatically get images by URL and save in uploads folder
- set_post_thumbnail_size vs add_image_size
- How to automatically add rounded corners to thumbnails?
- WordPress adding scaled images that don’t exist (1536×1536 and 2048×2048)
- Download an image from a webpage to the default uploads folder
- the_post_thumbnail responsive srcset not populating with custom image size
- How to change image type for specific size?
- New image size version only for the Featured Image file
- is it possible to replace the use of gd_lib with imagick or ImageMagick?
- Featured image shortcode
- How to find attachment by it’s name?
- Change WordPress image URLs via filter
- Image Scaling using get_the_post_thumbnail issue in WordPress
- Any easy way to automatically set the first inline image in a post as the thumbnail?
- Remove title attribute from images
- How do I delete all generated images from my server except those currently used in posts
- Insert an image into a post by API
- How to create thumbnails with a fixed width, so all of them will have the same width?
- How to limit number of images being printer out in “Set Featured Image” pop up?
- Black and White thumbnails
- Programatically creating image attachments from local URLs and setting featured image
- How can I add the “Use as featured image” to a custom metabox?
- Can WordPress crop only the post thumbnails?
- set_post_thumbnail_size not cropping featured images, but reducing proportionally
- How to grab first image attached to post and display in RSS feed?
- Double thumbnails?
- Is it possible to prevent users from uploading small images?
- Can’t Display Featured Image in RSS Feed
- Displaying a featured image (only img url) as the img src?
- Autogenerated Thumbnail compression depending on size
- How to output placeholder image if no featured image set?
- Cannot access the thumbnails of attachment images… Cannot find the reason
- Featured Images on Front Page
- Download button for Featured Image in every post – automatically
- Show prev and next post links for parent post of current image in attachment page?
- Setup A Default Featured Image
- When displaying the featured image, is has_post_thumbnail() necessary?
- Find posts without featured image? [duplicate]
- How do I add a featured image to a single post page?
- Changing playlist shortcode thumbnail sizes?
- Add a featured image in my theme?
- How to make programmatic image upload generate thumbnail and sizes?
- Get original image from thumbnail URL
- Cannot get full thumbnail size using the_post_thumbnail
- WP 3.4 has missing photo data
- Featured Image .svg height and width 1px only
- Save image as featured image
- Display latest 12 images from media library
- Thumbnails produce unwanted gray pixels on white background [closed]
- How to check if user is uploading/setting an image as a featured image?
- Image Quality Thumbnail Compression in WordPress?
- Images are randomly deleted from server
- Frontend Post – Allow Only Image File Upload
- attach unattached featured images to respective posts
- Images not working using Featured post
- Add instructions to featured image
- WordPress reduces the full size image and uses it as the original
- How do I get more image editing options in the admin?
- Thumbnails are bigger in size than the original image
- Remove image classes from post thumbnail output
- Exclude featured image from gallery in wp-admin
- Show featured image next to post-teasers in Genesis Framework?
- Show full image thumbnail
- Special purpose photos with each post
- How check that there is post thumbnail feature image or not on wordpress?
- Get thumbnail url of custom meta image?
- SVG Featured image not shown in twitter
- Featured images not displaying at full resolution
- If I Regenerate Thumbnails, would WordPress delete the existing Thumbnails and replace them with ‘new copies’?
- Woocommerce featured image of page – not product
- Set Post Image Using Shortcode
- Print specific image size in galley loop
- WordPress crops images differently on retina screens?
- Image thumbnails not available post migration, but still accessible via direct URL – DB issue
- How to get cropped thumbnail source for custom post type