Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Aiden Kwok
Aiden Kwok
9,136 Points

Post title colour change depending on author

I'm trying to set up a blog with multiple authors. The idea is to have each post title a different colour according to who wrote it (so each author has their own colour).

I know that I can change the post title colour according to category with css using '.category- ' but i'm looking for the same sort of solution based on author.

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

You may be able to select it based on the string of the author if you can somehow select the author as a value of something.

I know that with attribute CSS selectors you can use a string value to search attribute selectors and apply styles that way. I'm not if this would work for that case though.

Aiden Kwok
Aiden Kwok
9,136 Points

thanks for the help! I used the '.author-(user_nicename) {}' to change the colour of post titles according to author.