• Sorry for a – maybe – really stupid question:

    What is the reason, that the <body>-Tag is placed in the header.php and not in the other templates? The latter would make it easy to very individually design styles to templates… Maybe I miss something…

    Greatly thankful for any insight!
    eliZZZa from Austria

Viewing 4 replies - 1 through 4 (of 4 total)
  • You don’t have to place the <body> tag in header.php if you don’t want to. But having it there means that you don’t have to add it to every other template file. And you can still have individualised CSS for specific templates via the post_class() tag.

    Thread Starter eliZZZa

    (@elizzza)

    Great! That answers my question perfectly. So the ideal solution is post_class, which I was not aware of.

    Thank you so much!
    eliZZZa

    Thread Starter eliZZZa

    (@elizzza)

    P.S.: Oh I see, I was already using the post_class(ID)! So your first answer is useful as well, whenever I want to give every body a certain ID – but I guess, there is some automatisation possible too?
    Can I assign the post_class(ID) to the body tag as well?

    Not easily because you either need to be within The Loop to pick up a post ID or you’d need to run another query before the main Loop.

    What is it that you’re trying to achieve?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘body tag in header.php?’ is closed to new replies.