WordPress.org

Ready to get started?Download WordPress

Forums

How can I specify a CSS class to a blog title? (3 posts)

  1. HardinComp
    Member
    Posted 9 years ago #

    There are some posts I want to specify a specific CSS tag to in order to have a visual match to the topic I cover in the post. I tried it today, but it just mucked things up.

    Basically I want to be able to specify the class "Tulane" for posts I write about the Tulane baseball team at the College World Series. The CSS for that class is:

    .Tulane {
    color: #006633;
    font-weight: bold;
    }

    Is there a way to do this or am I trying to do the impossible?

  2. ifelse
    Member
    Posted 9 years ago #

    You could try something like this:
    <h2 class="if ( in_category('category_id') ){
    echo "Tulane";
    } ?>">
    <?php
    the_title();
    ?>
    </h2>

  3. HardinComp
    Member
    Posted 9 years ago #

    I'll have to try that, although it could get unwieldy if I want to do specific classes for multiple categories. Thanks for the suggestion.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.