WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Different post styles for different authors? (5 posts)

  1. ladydelaluna
    Member
    Posted 8 years ago #

    Has anyone been able to do this? For example, my posts and pages have a lavender background with purple links and my other admin's posts and pages have a melon colored bg with orange links?

    I'm sure it's going to have to rely on CSS div styles and such, but I'm looking for maybe some PHP "if/else" stuff that can be modified per author in order to pull in certain div styles (ex. my posts "content1" her posts "content2")?

  2. iand
    Member
    Posted 8 years ago #

    The simplest would be <div class="postby<?php the_author(); ?>"> and style accordingly.

  3. ladydelaluna
    Member
    Posted 8 years ago #

    so then the styles would be

    #postbyme

    and

    #postbyher

    ??

    but isn't there a need for some sort of "if/else" in there?

  4. iand
    Member
    Posted 8 years ago #

    There should be no need for if/else's. The code will just print <div class="postbyme"> or <div class="postbyher"> The only place it might break down is if you then add a third author without adding some CSS too.
    And it might be
    .postbyme etc.. I always get my # and .'s mixed up.

  5. ladydelaluna
    Member
    Posted 8 years ago #

    nope - you're right. "." for class "#" for id :)

    thank you!
    i'll let you know when we get the site up if this works... :D

Topic Closed

This topic has been closed to new replies.

About this Topic