Archived topic
Add custom CSS class to featured images
5 replies · Started by Jeno on July 23, 2021
Dear Support,
I would like to add a custom CSS class to my featured images so that I can exclude them from lazy loading inside WP Rocket. I have found a couple posts on the forum, but none shows a solution for this.
Thanks
Hi there,
Try this solution:
https://generatepress.com/forums/topic/excluding-featured-image-for-shortpixel-adaptive-images/#post-1349606
Hi Leo, it works for posts but not for pages. Would you be able to tell me how to do it with pages too?
Hi there,
in the code - look for this line:
if ( is_single() ) {
And change it to:
if ( is_singular() ) {
That causes the site to break: "There has been a critical error on this website."
Apologies i made a typo in the code it should be:
if ( is_singular() ) {