Support » Themes and Templates » php body_class property mix up

  • Hi,
    I am trying to use <body <?php body_class();?>> to apply different CSS rules to every template. The problem is, the properties I have specified in the CSS get mixed up. i.e. The H1 font color for body.home get applied to body.category-blog H1, although I have specified both of them separately in the CSS.

    Is there a parent-child relationship between the body classes? I have not explicitly specified it so in the CSS, but does WordPress create any such relationships?

    Thanks,
    -Tejas

Viewing 5 replies - 1 through 5 (of 5 total)
  • Its better to use Firebug to find out. It shown parent child inheritance and the CSS applied to each element hierarchically.

    esmi

    (@esmi)

    Forum Moderator

    Is there a parent-child relationship between the body classes?

    No. However, any given page on your site will have multiple body classes applied to it.

    Ajit, yes I use Firebug. That how I actually found that the class were not exclusively used for their own pages.
    Esmi – is there a work-around to this?

    esmi

    (@esmi)

    Forum Moderator

    How specific do you need this CSS to be? It could be just down to the order in the stylesheet – although I’m having trouble figuring out how the classes “home” and “category-blog” can appear on the one page.

    Any chance of a url?

    It’s on localhost currently, but I will try to push it on the server and see what we can do. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘php body_class property mix up’ is closed to new replies.