the_post_thumbnail with lazyload JQ plugin

If you want to apply lazyload to each attachment image, you can just add your hoot to wp_get_attachment_image_attributes filter:

add_filter( 'wp_get_attachment_image_attributes"https://wordpress.stackexchange.com/questions/54986/,"wpse8170_add_lazyload_to_attachment_image', 10, 2 );
function wpse8170_add_lazyload_to_attachment_image( $attr, $attachment ) {
    $attr['data-original'] = $attr['src'];
    $attr['src'] = "https://wordpress.stackexchange.com/questions/54986/grey.gif";
    return $attr;
}

Or if you can use second approach:

$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "size" );
// add more attributes if you need
printf( '<img src="https://wordpress.stackexchange.com/questions/54986/grey.gif" data-original="%s"/>', esc_url( $thumbnail_src[0] ) ); 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)