WordPress.org

Ready to get started?Download WordPress

Forums

Change CSS styling is post is in certain category (3 posts)

  1. michaelphill
    Member
    Posted 4 years ago #

    I'm working with a customized version of the main index page where individual posts each have their headline displayed in a box.

    What I'd like to do is, if a certain post is under a specific category, the default CSS styles for the page would be overridden by new styles that, at the very least, change the box's background color. I'd also like to be able to change the width of the box as well, if possible.

    Any tricks to do this?

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    not knowing what 'certain' and 'specific' rreally means, here some basic ideas:

    use the category slug as a class - for the page, for the posts, or just for the headline.

    for instance, with: http://codex.wordpress.org/Template_Tags/post_class

    and then put the respective styles into style.css.

  3. michaelphill
    Member
    Posted 4 years ago #

    Hmmm. How do I output the category name as just plain text (as opposed to a link) inside the loop?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.