Responsive images are in WordPress core since 4.4
https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/
srcset
and sizes
are used to accomplish this.
If your theme doesn’t implement these properly you will have to modify theme files.
<?php
// Specifying width of 400 (px) and height of 200 (px).
$srcset = wp_get_attachment_image_srcset( get_custom_header()->attachment_id, array( 400, 200 ) );
?>
<img src="https://wordpress.stackexchange.com/questions/318150/<?php header_image(); ?>" srcset="https://wordpress.stackexchange.com/<?php echo esc_attr( $srcset ); ?>">
https://developer.wordpress.org/reference/functions/wp_get_attachment_image_srcset/
Related Posts:
- Separate Media Library for each user
- Maintaining image color and quality when uploading using custom sizes
- Bulk edit wordpress images alt and title attributes
- Upload Image Not accessible
- Separate attachment images from post loop
- Caption in Page adding unwanted 10px to width
- Rename attachments during upload
- alt, title tags not showing
- Adjust image caption within visal editor
- Why can’t I edit certain images from the WordPress Media library?
- How to add a media with PHP
- Responsive Images – Add srcset attributes to custom Images Function
- How can I store an image in the database with Transients API?
- How to prevent resized featured images?
- Get original image from thumbnail URL
- WordPress url image redirect to the homepage
- Bulk image rotation
- Can I the caption shortcode to set caption to a data attribute, and with the image’s alignment intact?
- Is there a way to delete images from WordPress media library programmatically?
- get the image of the post
- Update image links in database
- Special purpose photos with each post
- ACF Image ID, echo the alt tag
- WordPress – different icon image depends of comment number
- Multiple images with Media Uploader on front-end
- Pull Random Attachments With Pagination
- Upload media files to Amazon S3
- Out of memory error reporting
- image uploaded cant be shown
- Turn off image captions in gallery view?
- How to get default image sizes attribute
- Remove the inline styling added in wp_get_attachment_image()
- Unyson Framework doesn’t show gallery images
- Image not shown in the theme as it’s showing in HTML template [closed]
- add_shortcode to capture URL screenshot not loading correctly
- Broken Images until Page Refresh
- Show image crop window on image upload
- Get image from parent category
- Images attached to posts from library link to 404 error page
- Images not displayed when moving site to local
- Uploaded images not displaying in network site
- fetch images and videos
- Specific image size is being generated without being registered
- How to limit the number of images displayed in the media window?
- Should I not compress my jpeg files before uploading to avoid double compression?
- Is it possible to preserve original images in order to change image size later?
- Generating a certain sized thumbnail on the fly?
- How to display title of attached image in post?
- Getting thumbnail of uploaded image
- Need custom picture field for pages
- Only make custom image size if uploaded via Thickbox and attached to certain page
- Link listings with image
- Allow users to contribute images to a post
- Can’t add image to site via php
- After Migration, images show up on a preview of the page but not the actual page [closed]
- Use default image as var
- How to apply image alt descriptions from media library?
- Save Image in wp_options-Table
- Specify automatically the height and weight of the images
- Image upload error?
- Is it possible to get feature image url (full-size) from an image url of smaller size?
- How to crop images in a certain size only for a certain page?
- How to pass on a value as parameter via url to another page
- Image not showing using a custom function and get_post_meta
- Random home page background images with caption text
- How to add “alt” attribute for image during upload at WP front-end?
- How to change image’s author via a function when using GravityForms uploader? [closed]
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- Featured Image Thumbnail size on Twenty Ten Archive Page
- Using different size thumbnails on different parts of my site… with functions.php?
- Hover a css icon width other color inside wp_get_attachment_image
- Widget Style – Icon Type
- WordPress Problems
- Pictures randomly replaced by blue question mark
- WordPress PHP custom function is causing 500 Internal Server Error Connection Timeout
- Post-processing of the image failed
- Get post thumbnail in specific size
- How to skip the creation of landscape thumbnails for an original portrait image
- Why are my button images blurry on mobile screens?
- How to find the largest images in wordpress post
- New portfolio items appearing smaller on the grid
- Image automatically resized
- WAMP install acts different than live install when uploading images
- Images Wont Display After Importing From Old WordPress
- Image thumbnail on single product issue | WooCommerce
- How can I hook and edit on the fly an image uploaded
- Anomaly with response coming from XML RPC Api get Post (integer out of range)
- Make all images displayed in single.php a certain size
- wp_get_attachment_image_src
- I am trying to get metabox image with custom size
- Removing image dimensions from `the_content`
- Is there a different way to grab a thumbnail image than this?
- Multiple gallery thumnbnails on one page
- Change image link in excerpt to point to post
- Putting the title attribute in image tag — Snapshot Theme from Woothemes
- Post migration – images do not display
- Change the avatar ratio?
- wp_handle_upload Image sizes
- How to show file type of featured image?
- Profile Image displaying on Wrong side of WordPress Navigation Menu