Forums

body tag in header.php? (5 posts)

  1. eliZZZa
    Member
    Posted 2 years ago #

    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

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    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.

  3. eliZZZa
    Member
    Posted 2 years ago #

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

    Thank you so much!
    eliZZZa

  4. eliZZZa
    Member
    Posted 2 years ago #

    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?

  5. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic