How to set a element style based on a custom field value?

Is there a way to set an elements style value based on a custom field value?

I have a loop which displays CPTs. Each CPT has a custom field for Status.
I want to set the background colour of the card depending on the Status of the CPT.
e.g. Green for Active, Red for Closed, Yellow for Pending.

I thought that either Conditions or Interactions might be able to do this, but doesn’t appear so.

Thought that maybe I could set the Status field value to be a colour and then use that dynamic value in the style … but it introduces other issues with users understanding! Users are always a problem. lol

Any ideas?

Hi

You could use the attributes filter for that.

See this:

Cheers

Patric

Cool thanks, will see if I can make that work.