Okay, at least I’m using the correct function. I am using wp_get_attachment_image_url() to pull the image. But it’s still not working…
Here is how my code is setup. I prepare all the data ahead of time in a loop because I output the same image in a couple of places.
loop1
(do some stuff)
$data[$count]['image'] = get_post_thumbnail_url()
(do some more stuff)
endloop1
loop2
(do some stuff)
echo '<img src="'.$data[$count]['image'].'" alt="'.$data[$count]['name'].'"></a>';
(do some more stuff)
endloop2
loop3
(do some stuff)
echo '<img src="'.$data[$count]['image'].'" alt="'.$data[$count]['name'].'"></a>';
(do some more stuff)
endloop3
Is this why the lazy loading doesn’t work? What would be the proper approach in PHP to get it working?
-
This reply was modified 4 years ago by scrlk.
-
This reply was modified 4 years ago by scrlk.