• So I read HERE that it is possible to use the body_class() system to style specific pages.

    Based on their CSS code I assumed it was as easy as changing:

    #header { origianl css for header here }

    into

    body.page-id-90 #header { this is the new css header for JUST page-id-90 }

    I assumed that you could have both of these CSS ID’s in the same CSS file and doing this for the entire original theme, you could then customize all of the fields with body.page-id-90 so that the page with page-id-90 would look completely different from all other pages.

    If thats the case, can someone give me a working example of what this code would look like for the restyled “body” tag? For instance, the theme has the following CSS:

    body { margin: 0; background: #ffffff; }

    so would the page-id-90 version look like this?

    body.page-id-90.body { new style here }

    or do I need to put an ID in the body tag as well so I can call it like:

    body.page-id-90 #body { new style here }

    Whats really confusing is that the body element will have a class tag that is filled with a long list of classes and yet I don’t think I should add them recursively. For instance I wouldn’t put:

    body.page-id-90 body { new style here }

    because the body tag actually looks like this on the new page.

    <body class=”page page-id-90 logged-in”>

    Please someone explain how I can use this new styling approach to ensure that my page-id-90 is completely customizable.

    Thanks in advance!!

Viewing 1 replies (of 1 total)
  • Thread Starter ceruleansin

    (@ceruleansin)

    Quick update:

    I discovered that overwriting all the CSS is possible, but it’s a pain. I’m not sure if I’m doing something wrong.

    It seems that when you set the second set below, it only overwrites the first set IF you put something in the CSS brackets.

    #body { css here }
    becomes
    body.page.page-id-90 #body { CSS here }

    BUT ONLY IF

    body.page.page-id-90 #body { IS NOT EMPTY }

    This presents major problems if you are trying to style a NEW page because 1) you have to use all the old ID’s and CLASSES and 2) If you don’t USE all of the old ID’s and CLASSES the old CSS code shows up.

Viewing 1 replies (of 1 total)
  • The topic ‘Using body_class() to get multiple themes on one blog’ is closed to new replies.