Support » Themes and Templates » body class

body class

  • Hi, If I add:

    <body <?php body_class(); ?>>

    Do I need to delete my opening and closing body tags?


Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Michael


    Forum Moderator

    this obviously replaces the <body> tag – and naturally you need to keep the closing </body>


    thanks for the reply, I figured that was probably the case. Im assuming if I do PHP head() I need to delete the <head> tag also? and leave the closing </head> tag?

    Im super new here so I apologize for the basic-level questions

    Thanks again

    Moderator Michael


    Forum Moderator

    Im assuming if I do PHP head() I need to delete the <head> tag also?

    don’t delete the <head> tag;
    what is PHP head() ?

    do you mean wp_head() ?


    this needs to be added before </haed>

    Thanks, yes I mean wp_head() . So if I use wp_head() you are saying I should leave the <head> tag before it and add the closing </head> sometime after it–right after according to the docs?

    Why don’t you just try it out and see what happens?

    Thats the problem I did it both ways leaving the <head> and removing it and it makes no difference either way so I want to know the CORRECT way to do this as it does not specifically state to remove the <head> tag anyplace in the WordPress codex that I can find it only says to place wp-head right before the closing </head> tag.

    This could mean that one with limited WordPress knowledge like myself can deduce that it is either possible to leave <head> or remove it. But I do not know what way is what WordPress wants.


    Moderator Michael


    Forum Moderator

    ‘normally’ the <head> and </head> would be already in the header template (this is normal html programming) so you would add <?php wp_head(); ?> simply before the existing </head>

    have a look at the header.php of existing themes such as Twenty Eleven …

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘body class’ is closed to new replies.