Site logo

Archived topic

Add class when disable feature image

5 replies · Started by Gonzalo on September 28, 2022

Viewing posts 1–6 of 6

Hi there,
I would like to add a special class, only to the posts that set the featured image disabled.
Can you help me?

Hi Gonzalo,

What are you planning to do?

There's a class that's added or removed - featured-image-active - depending if the feature image is enabled or not.

You can use the existence or non existence of this class with your code.

Hi Fernando,
I need add class, when featured image it's disabled.
e.g.
`.my-class .featured-image-disabled {margin-top:50px;}

I guess that class doesn't exist. Maybe with a PHP condition?

You can use body:not(.featured-image-active).

Great, thank you Ying!

No problem :)

This archived topic is closed to new replies.