WordPress.org

Ready to get started?Download WordPress

Forums

Color code specific category's article (2 posts)

  1. joerpnet
    Member
    Posted 2 years ago #

    Hi,

    I want to highlight articles of a specific category and its subcategories. How can i change the background color of the articles in the blog list?

    thanks,
    Joe.

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 2 years ago #

    If your theme makes use of the body class and post classes, and most do, you can use css

    First, do a view source of your site to look at your source code to make sure its good

    You just click view in your browser and go to source/source code...

    look for something like:

    <body class="home blog paged logged-in admin-bar paged-2 single-author two-column right-sidebar">

    And

    <article id="post-681" class="post-681 post type-post status-publish format-standard hentry category-filters tag-add_action tag-filter tag-pre_get_posts">

    That's off my index page for a certain post.... you can see all sorts of options in there,

    The body class lets you target the proper page, and the article (or it might be post) class lets you target posts based on certain criteria

    So I pick home from the body class and category-filters from the article class

    And I can target and posts on the blog listing in the filters category

    So in style.css if I put:

    .home .category-filters {
         color: #fff;
         background: #401f1f;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic