WordPress.org

Ready to get started?Download WordPress

Forums

Per Category Shading (4 posts)

  1. cyskon
    Member
    Posted 9 years ago #

    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.

  2. Muffinboy
    Member
    Posted 9 years ago #

    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.

  3. cyskon
    Member
    Posted 9 years ago #

    Thanks, I will surely try that.

  4. cyskon
    Member
    Posted 9 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.