Can I style one category with CSS? (6 posts)

  1. Karb
    Posted 11 years ago #


    I know with asides you can style them to stand out. Can that be done with any category? For instance say I want an events category and I really need that to stand out from regular posts can I?

    Thanks for any suggestions.

  2. cron
    Posted 11 years ago #

    Yep sure you can. You just need this code:

    <?php if (in_category('29') ) { ?>
    post stile for cat #29
    <?php } else { ?>
    For all other posts
    <?php } ?>


  3. Karb
    Posted 11 years ago #

    Cool, thanks - so I just put that in the loop right?

    Also, (not sure whether this should be a new post) - can I take say the category 'Events' off the home page and show all event category listings on a 'page'?

    Thanks again :)

  4. cron
    Posted 11 years ago #

    Yep, just put it in the loop on the main page. As for what you want, what you can do is set it so that it does not display posts in the events category on the main page using:

    $cat ="-29";
    include(ABSPATH . '/wp-header.php');

    Then you eather create a new page and install a plugin that will let you use PHP or make a new page template and use that. Then use loop comands in the page to show those entries.

    It would be eiser however just to use the category pages that wordpress generates automaticly and style that.


  5. Karb
    Posted 11 years ago #

    thanks for the info :)

    Seems to be a day of questions. Next, can I show future posts of a certain cat?

    Sorry for all the questions.

  6. cron
    Posted 11 years ago #

    Event Calender is a plugin that will allow future dated posts to show up in the calender as long as they are in the "event" category as well.

    I forget the name but there is also a plugin that will allow you to see future dated posts if you link to them directly. These two plugins work perfectly together.


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.