WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Karb
    Member
    Posted 9 years ago #

    Hi,

    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
    Member
    Posted 9 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 } ?>

    Cron

  3. Karb
    Member
    Posted 9 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
    Member
    Posted 9 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";
    require('./wp-blog-header.php');
    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.

    Cron

  5. Karb
    Member
    Posted 9 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
    Member
    Posted 9 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.

    Cron

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.