Site logo

Archived topic

Add custom CSS class to featured images

5 replies · Started by Jeno on July 23, 2021

Viewing posts 1–6 of 6

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 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() ) {

This archived topic is closed to new replies.