WordPress.org

Support

Support » Requests and Feedback » Per Category Shading

Per Category Shading

  • Hello Support,
    I was wondering if anyone has thought of creating a plugin that would allow you to shade a post based on the Category that is a member of.
    You would have to create the css for the category yourself, giving it the name of the category so that it will be easily identified.
    This plugin will work with the WP system to monitor the categories of each post and use the required css as required.
    What would be also great if it these shading would be visible on the main page, so that when someone visits the site, they will be able to see the different css working on the post based on their category.
    Of course there are posting that will be assigned to multiple categories. What I propose here is that the last or first category select for that posting (you could do it alphabetically as well) will be used for that post.
    Hope the WP gurus see this as something worth looking into and giving it some life.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Muffinboy

    @muffinboy

    In your index.php wrap the “post” div in another div that looks like this:
    <div class="<?php the_category(',') ?>">
    <div class="post">
    all the normal stuff goes here
    </div>
    </div>

    In your stylesheet just define the classes with the same names as your categories, but beware, you cannot use category names with a space in them, because CSS selectors cannot have spaces in them.

    Thanks, I will surely try that.

    Didn’t work, all it did was reprint the categories at the top of the post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Per Category Shading’ is closed to new replies.