Colour posts on blog page by their category

asked Apr 15 in Wordpress Themes by hockney (120 points)

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.

1 Answer

answered Apr 17 by lisa-west (27,280 points)

Currently TemplateToaster provide same color option for all posts, to use separate colors for each category post you can use any third party Wp-plugins e.g , etc.

Anyone interested in localization of TemplateToaster v7 in exchange of a Pro License Contact Us