I'd like to give each blog post category a background colour.
E.g.: Category 1 = red; Category 2 = green; Category 3 = blue
Then on the blog page, each post in my 4-column layout would have a background determined by the chosen category of the post:
Post A (cat 1) | Post B (cat 2) | Post C (cat 1) | Post D (cat 3) |
Post E (cat 2) | Post F (cat 1) | Post G (cat 3) | Post H (cat 3) |
How would I do this?
I can't see an option in the toaster, so wonder if I can use a .php filter?
---
Yeah, I know it has a danger of looking quite awful, but that's a risk I'm willing to take.
If two or more categories are selected for a post then it doesn't matter which colour is picked - probably the first in the list for that post.
I'd settle for colouring the post header background, rather than the whole post (would be less tacky).
Using Wordpress 4.9.5 (latest), and building a brand new theme so no backwards compatibility issues.