This is a hack, but I guess it should work…
add_filter( 'wp_get_attachment_image_attributes', 'wpse8170_add_lazyload_to_attachment_image', 10, 2 );
function wpse8170_add_lazyload_to_attachment_image( $attr, $attachment ) {
//use your image size here with attachment
if($attr['class'] == 'attachment-large'){
//do your stuff
}
return $attr;
}
Related Posts:
- How do I add the featured image to the_content after the first paragraph?
- How to replace the_post_thumbnail template tag and show the first inside the post image instead
- Adding schema itemprop image to the_post_thumbnail with filters
- How to show a featured image as current?
- Delete original image – keep thumbnail?
- the_post_thumbnail responsive srcset not populating with custom image size
- Set custom name for generated thumbnails
- How to add multiple image sizes of the same size with add_image_size
- change set_post_thumbnail_size according to post type admin page
- Can’t extract and set SVG dimensions
- Getting Thumbnail Path rather than Image Tag
- How to crop thumbnail height to auto with set width
- Image uploader with “Set Featured Image” link on front end
- adding an id to the_post_thumbnail
- How can I display my featured image correctly inside my single posts?
- Featured image upload finished hook
- Generate thumbnail for images with the same size as thumbnails
- Implementing Zurb’s Interchange Into WordPress
- How to get_posts having post thumbnail?
- add_image_size and add_filter(‘image_size_names_choose’, ‘my_custom_image_sizes’) not working with wordpress 3.5.2
- Custom post type thumbnail / Media Library WP_DEBUG notice [closed]
- Add body class based on existance of post thumbnail. Code works but receiving PHP Notice
- Delete all thumbnails for a post
- How to display thumbnail + tags + title of a child page?
- Archive Thumbnail Gallery
- How to delete posts that does not have a thumbnail?
- How do i show wordpress attachments from current post?
- How to get full absolute url for post attachment?
- Can’t get image size set with set_post_thumbnail_size() function
- How to check the array of featured images IDs
- Show LightBox when clicking on featured image [closed]
- Can’t check if a post has thumbnail adding filter to get_post_metadata()
- How to removes all instances of thumbnails displayed in my theme?
- Get ID of featured image using “get_post_thumbnail_id(the_ID())” – without printing to screen?
- what is the difference between timthumb and post thumbnail?
- Duplicated featured image is not showing
- Create thumbnail size only for a few images?
- How to find post with broken image link and delete that post
- Else condition not working while using has_post_thumbnail
- Only Display Thumbnail if Larger Than
- WP Query to set post thumbnail for existing old posts
- get_post_thumbnail_id() Doesn’t return value [closed]
- Why is the post title and content automatically being displayed in the post thumbnail (Featured image)?
- How to deal with wordpress images?
- Disable post thumbnails in Twenty Thirteen child theme
- How can I find the first post in a category that has a featured image and then return the get_the_post_thumbnail()?
- Post thumbnail throwing size limit parameters in
- How do I add a default thumbnail to elseif when no get_field(‘photos’), and no post thumbnail exists?
- Problem with showing featured image
- How to disable thumbnail filter for a specific template part or image size?
- Getting img src from thumbnail_id using javascript
- Easy way to update a single translation entry without having to translate
- If the_post_thumbnail(); is this – echo this text
- Featured image not working
- Insert post’s category name into thumbnail string
- Is it possible to enable the ‘Link To’ field under ‘Attachment Display Settings’ for a Featured Image?
- Icon over thumbnail according to post format
- Tweak next_post_link for it to include thumbnail
- The location of the html output from the_post_thumbnail();
- the_post_thumbnail() doesn’t always return selected size
- Removing URL and adding container around image in the featured image metabox
- WordPress not creating “large” thumbnails
- Get a random thumbnail from posts belonging to a specific taxonomy
- Custom caption output for custom image size
- how to create extra post thumbnail with merge of an icon image?
- Getting featured image setting as background
- Unable to set Custom “Link URL” for Featured Image, and More?
- On what point (hook) does the_/has_post_thumbnail() load?
- First Image not loading on Mobile Version of Website
- How to apply filter on get_the_post_thumbnail()
- Make 1st Slide of PowerPoint file to be the Post thumbnail preview image
- Is it possible to set Featured Image using HTML?
- Set featured image from auto generated video thumbnail url php
- How to cropped thumbnail image without distorting it?
- wp_get_attachment_metadata()[‘image_meta’] fetch WP metadata or EXIF?
- White Blank screen and issue to get thumbnail in
- Set Featured Image Based on Custom Field
- changing size image within the content
- Post thumbnail on specific template
- Using lower resolution/size images for thumbnails on posts index
- How to have featured image show in standard RSS Widget
- Link from Thumbnail to Post not working
- Featured Image metabox (postimagediv) doesn’t appears when it should
- Thumbnails not showing in blog
- Featured Image inserted through custom query, does not show up
- How to import linked images and make them featured -> automagically
- Change role’s settings influence post-thumbnail
- Wrap Featured Image in a Link
- Thumbnail images
- Featured Image Thumbnail Sizing
- Featured Image Isn’t showing with cropped, How to show it?
- How to modify Media Library images DPI [ image quality down to make small in size ] [closed]
- How to add text & call to action button to featured image on homepage?
- Featured image as background in a div using headway
- php code for image fetching
- get_post_thumbnail_id() not getting correct featured image after post edited
- the_ID & wp_get_attachment_image_src(the_ID(), “medium”) blank
- How to I remove Featured Image from the Posts/Category Lists?
- How do I change the size of the feature picture of a single post?
- Close featured image modal windows with JS