I think wp_get_attachment_srcset()
is what you are looking for.
$srcset = wp_get_attachment_image_srcset( $image['id'], array( 100, 100 ) );
Now you can escape the HTML and use it in your code.
<img src="https://wordpress.stackexchange.com/questions/276972/PATH HERE" srcset="https://wordpress.stackexchange.com/<?php echo esc_attr( $srcset ); ?>">
Related Posts:
- How do I disable responsive images in WP 4.4?
- WP 4.4. responsive images browser choosing the “wrong” one
- How to insert pictures without hard coded dimensions?
- Making WordPress Gallery (.gallery-item) Responsive?
- WP 4.4 aspect ratio with responsive image
- How can I serve different images depending on screen size with wordpress
- How to Make WordPress Default gallery responsive on mobile?
- Responsive background images added inline
- Get a list of all image sizes that match aspect ratio of original one
- How to exclude an image size from the WordPress srcset
- Responsive Images Resizing Images
- Featured image (responsive) above content is too small after update to WordPress 4.4
- How to display a different image size for mobile
- WP Responsive images – upload custom image sizes
- Fuzzy Images in WordPress 4.4
- Removing height and width from images with a caption
- How to create ‘Local’ filters for WordPress srcset sizes in template parts?
- Multiple amp-image overlays. How to properly do this in wordpress?
- Fallback for missing srcset images
- max_srcset_image_width doesn’t work as intended
- Using SRCSET with Images and Featured Images
- Understanding WordPress image sizes and responsive images
- Custom responsive ‘featured image’ sizes
- One of my image sizes isn’t showing up in srcset
- How to stop WordPress from completely overriding my tags in my templates?
- Adding srcset to an image in ajax
- the_content not showing responsive image attributes srcset or sizes
- Serve different images per screen size and cache possible?
- Disable Media File Image Link On Mobile Devices
- All 3?: Responsive resizing of images + image width of actual image for small images + max-width for all larger images
- Why does WordPress list all image sizes in srcset even if they’re larger?
- Responsive header image
- What’s are some best practices for responsive images (e.g. for section headers)?
- WordPress Responsive Image ( srcset ) not work properly
- Responsive Images – Defining
- Decide how Hero image appears on mobile
- Responsive Featured Images Not Working
- Responsive images with srcset
- Getting extra image links in code with wp_get_attachment_image
- built-in responsive images in content – do I need to add anything to functions.php?
- Responsive images in Bootstrap 4 slider
- WordPress not choosing the right image from srcset
- Responsive Images in WordPress
- Is there a good way to use CMS images with CSS
- Remove one srcset entry from wp_get_attachment_image
- Generate / attach Image srcsets from ACF Image Field
- Automatically replace original uploaded image with large image size
- How to scale up featured post thumbnail?
- Custom image size / thumbnail – Crop to aspect ratio even when source image is smaller than set dimensions
- Create image formats with different qualities when uploading
- Change WordPress image URLs via filter
- How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
- hook into completed image upload filter
- Generating Responsive Background Image Sizes in PHP
- Get img alt tag from a Image that has been uploaded through the Customizer
- Get Attachment ID from URL [duplicate]
- How to set twenty fourteen header image at 100% width?
- Can’t Display Featured Image in RSS Feed
- Automatically Add Caption in image
- Different captions for the same image in multiple galleries. Edit Image in Gallery locally
- Custom image size not regenerating when image editted
- Image still linked as attachment to page even though it has been deleted
- Is 700,00 jpgs too many for a WordPress site.?
- Change the RSS feed image
- Plupload resize for worpdress
- Question about add_image_size()
- Photography Based Design – Multiple Images Per Post
- Remove Size images without use
- Woocommerce featured image of page – not product
- Store Snapshot created via wordpress to use with lightbox
- Include caption underneath post images
- How to prevent WordPress scaling large images down
- Can’t get images to align with Gutenberg editor
- Show image EXIF info
- wp_customize_image_control deprecated add_tab alternative
- How to check for images before echo
- Two “the_excerpt” questions
- How can I use wp_save_image_editor_file filter?
- How to set featured image from external url programmatically
- Capitilize Alt/Title Tag in Image HTML, Reorder HTML Output
- How to display a sized image from Simple Fields repeatable field
- Allow admin roles to add images to comment replies
- Calling two images at a time? A better way?
- Image Captions Have a 10px Extra Margin, And It’s Not CSS? [duplicate]
- Image.php Problem – Post Images Not Displaying In It
- Apply manual image cropping not to thumbnail but medium_large size
- Hide or mask the url to an image
- Trouble with Uploading and Displaying Images
- How can I insert and display copyright owner field on featured-images, pictures and galleries in articles?
- Image alt attribute
- Non-existent child page URLs redirects to the image attachment URL instead of throwing 404
- Images not loading on wordpress.org site
- second featured post not displaying on page [closed]
- how to remove / hide ‘featured image’ option from side menu
- How to get attachements URL from author meta and display them?
- Missing Images in Uploads Directory (Server Only)
- Img alt tag showing different value then entered
- WordPress Missing Images
- Display first image’s caption
- The uploaded images are only full-size (original)