WordPress.org

Ready to get started?Download WordPress

Forums

body class (8 posts)

  1. roclimb
    Member
    Posted 2 years ago #

    Hi, If I add:

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

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

    thanks
    rob

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

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

    http://codex.wordpress.org/Function_Reference/body_class

  3. roclimb
    Member
    Posted 2 years ago #

    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
    rob

  4. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

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

    a:
    don't delete the <head> tag;
    b:
    what is PHP head() ?

    do you mean wp_head() ?

    http://codex.wordpress.org/Function_Reference/wp_head

    this needs to be added before </haed>

  5. roclimb
    Member
    Posted 2 years ago #

    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?

  6. Steffen Jørgensen
    Member
    Posted 2 years ago #

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

  7. roclimb
    Member
    Posted 2 years ago #

    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.

    Thanks

  8. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    '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 ...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags