Custom CSS Based on Author in WordPress

I had been trying to figure out how to change the text (colors and such) of posts in WordPress based on the author and saw quite a few different ways of doing it…none of which I thought were easy. I’m not sure if this has been mentioned elsewhere before, because I couldn’t find it…so here is my two-step version. Yes…two steps.

Now, this is going to describe how to do it with the default theme in WordPress 2.0, but I use it with the K2 theme over at www.crystalandshane.com to make my posts blue and Crystal’s posts pink .

  1. Open index.php in the /wp-content/themes/default folder and find the line that says:

    class=”entry”

    Replace it with:

    class=”< ?php the_author() ?>

  2. Open the style.css in the same folder and add styles based on the authors’ names. Here is how I use it for Shane and Crystal:
    .Shane {
    font-size: 1.4em;
    line-height: 1.2em;
    color: #393B79;
    }

    .Crystal {
    font-size: 1.4em;
    line-height: 1.2em;
    color: #9C4976;
    }

    Just save & upload those 2 files and you now have custom CSS styles based on the author’s name!

So there you have it…a simple and quick way to have completely custom CSS based on the author of a WordPress blog. I’m sure there are just as simple ways to do it with TextPattern, Moveable Type, etc but I have only used WordPress. Check out the final results of the above example at www.crystalandshane.com .

0 Responses to “Custom CSS Based on Author in WordPress”


  • No Comments

Leave a Reply