WordPress.org

Forums

Best approach to style pages by category (6 posts)

  1. exit6
    Member
    Posted 5 years ago #

    Hey, I'm building a new site and want to style posts in a certain category differently than the others. Different background image, basically. What's the best strategy for this kind of thing?

    Thanks --

  2. @mercime
    Volunteer Moderator
    Posted 5 years ago #

    Create Category templates where you could add CSS ID's or classes etc to be able to style respective categories differently

  3. exit6
    Member
    Posted 5 years ago #

    Right, that's how I do it for category pages. But how can I style post pages, "single.php" differently depending on what category the post is in?

  4. @mercime
    Volunteer Moderator
    Posted 5 years ago #

    I see you're using WP 2.8. Unknown to some, there is a new body_class tag which will allow themers to add more style to certain posts. Check out
    http://wpengineer.com/wordpress-28-body_class-automatic_feed_links/
    http://www.nathanrice.net/blog/wordpress-2-8-and-the-body_class-function/

    There's a plugin but haven't tested it for 2.8
    http://wordpress.org/extend/plugins/post-template/

  5. Xamataca
    Member
    Posted 5 years ago #

  6. exit6
    Member
    Posted 5 years ago #

    Great, I'll look that stuff over. body_class sounds like a winner.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.