0

So I'm pretty new at Wordpress development, and I'm a little confused by one thing. After going through and finishing my navigation in my header.php file, I went over to my template for the home page I'm working on. My question is: since the "body" tag is the only place you can write that actually shows up in the browser ("header" tags are for meta data etc), can I have more than one body tag? I read a little into html 5, and it seems there are more tags than just "body" now, but what's the best way to do that? I already have my menus wrapped in and what do I do with the footer, etc? Thanks for any help.

2 Answers 2

1

Structure your theme so you start the <body> in the header and you close the </body> in the footer (same thing for the <html> tag):

header.php

<html>
...header content
<body>   <!--- body is started in the header, used on every page -->

index.php, page.php, single.php, home.php - etc

...content

footer.php

...footer content
</body>   <!-- body is closed in the footer, also used on every page -->
</html>
2
  • Thank you so much! That was so confusing to me. Lol. I knew you couldn't have more than one body tag, so I just didn't get how WordPress could split it up. Makes sense though. :)
    – geektripp
    Dec 27, 2016 at 16:16
  • sure thing...accepting the answer would be helpful - thanks!
    – C C
    Dec 27, 2016 at 22:13
0

This may help you regarding having two body tags. is_front_page() will help you to echo body tag conditionally... either in header/footer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.