WordPress.org

Ready to get started?Download WordPress

Forums

Different CSS for each category page? (7 posts)

  1. superultra
    Member
    Posted 10 years ago #

    My wife's blog (http://www.popularstranger.com) has different categories, and she's used MS paint to draw up different backgrounds for each of her categories (links, paint-ings, photos) that I've setup as different stylesheets. I'm thinking a php if statement at the beginning of the index.php to choose the stylesheet using $cat would work, but I'm new to php. How do I code in php
    If category = links, then links.css; if category = paint-ings, paint-ings.css, if cat=photos then photos.css, and for everything else this.css?
    thanks for the help. I think most communities would be annoyed with all the refugees but the WP community has risen to the occassion. kudos.

  2. superultra
    Member
    Posted 10 years ago #

    Figured it out. =)

  3. Nick Momrik
    Member
    Posted 10 years ago #

    I like the design and how the posts are setup. Very unique...I've never seen something like that anywhere else! Just goes to show the power of WP. :-)

  4. dss
    Member
    Posted 10 years ago #

    It's great you figured it out.
    mind sharing it with us?
    dss

  5. OperaManiac
    Member
    Posted 10 years ago #

    Funky :0)

  6. davidchait
    Member
    Posted 10 years ago #

    Note that you can do this with a single CSS file, and one change to the index.php... at least for category pages.
    Change
    <div id="rap">
    into
    `<div id="rap<?php echo $cat?"-$cat":""; ?>">
    That will make styles #rap for non-cat pages, and #rap-1, #rap-2, etc., for category pages. You can also get the catname for the numbered cat and use that instead in the echo.
    I use quick tricks like this for modifying per-post stylings.
    -d
    http://www.chait.net

  7. Anonymous
    Unregistered
    Posted 10 years ago #

    l

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.