Site logo

Archived topic

"featured-image-active" class gone from body tag

5 replies · Started by Rafał on October 31, 2021

Viewing posts 1–6 of 6

I've added this little snippet to my functions.php, to get use of it again, but I still wonder if it was intentional to get rid of the class since GP 3.1?
Moreover, seems that featured-image-active class is reserved, so I had to use other name (e.g. has-featured-image), and rewrite my CSS.

Hi there,

The class itself is still being used by the theme - https://github.com/tomusborne/generatepress/blob/b60b853630da6d9015722da903e53c8064148b0a/inc/markup.php

But there's a function on GP Premium's files that removes this class. Its usage is conditional depending on if featured image is disabled/enabled.
https://generatepress.com/gp-premium-2-1-0/#:~:text=General%3A%20Remove%20featured-image-active%20body%20class%20if%20featured%20image%20is%20disabled

Hi Elvin,
In GP 3.0.4 it worked as I supposed: A Post or Page had Featured Image — then body tag had class featured-image-active, otherwise had not. There was no need to deal with any on/off switch for featured image.

Anyway, nothing big, I'm going to live with additional snippet ;)

The theme only adds it in and it should still be adding it in as this behavior was not changed in the latest version.

The removal toggling of this class is done on GP Premium's end as mentioned in this changelog. :D
https://generatepress.com/gp-premium-2-1-0/#:~:text=General%3A%20Remove%20featured-image-active%20body%20class%20if%20featured%20image%20is%20disabled

You can view/compare versions here - https://github.com/tomusborne/generatepress/releases

GP's code is open to public. :D

It's up to GP Premium, I see now.
I think you shouldn't care about this issue anymore.
Best regards!

No problem. Glad to be of any help. :D

This archived topic is closed to new replies.