WordPress.org

Ready to get started?Download WordPress

Forums

Spun
[resolved] tag and category colors (7 posts)

  1. miharbio
    Member
    Posted 1 year ago #

    Hello,

    Is there a simple way to manage colors and effects for specific categories and tags of posts?

    thanks

  2. Caroline Moore
    Member
    Theme Author

    Posted 1 year ago #

    Sure, read up on the body_class() function, which applies specific CSS classes to tags and categories (among other things).

  3. miharbio
    Member
    Posted 1 year ago #

    Thanks, though, it's been a little hard trying to wrap my head around this...

    I know coding help here is merely a courtesy.., but do you know where I might be able to find more thorough examples?

    thanks, again

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    Hi Miharbio,
    Do you have Google Chrome?

  5. miharbio
    Member
    Posted 1 year ago #

    I do. Is there a way inspecting the elements of the page will guide me here?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    Yes, for example, right click on the page and select 'inspect element'.
    You can see a new toolbar appear that exposes the HTML (on the left) and CSS applied to that HTML (on the right).

    Try searching through the HTML for particular classes that uniquely identify the post/ page, in relation to Caroline's advice.

    Look at the <body> element. That has a bunch of classes, of which the unique class may be something like 'page-id-10'.

    You can then construct some CSS from this:
    (example)

    .page-id-10 .post {
     background: deeppink;
    }
  7. miharbio
    Member
    Posted 1 year ago #

    Ohh, I think I see, now.

    I didn't understand how what wordpress calls "tags" and "categories" are processed as "classes" with the code, if that is the right way one would say it.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.