How to Find a Body Tag in WordPress Blog

Save

In HTML code, the <body> tag defines the part of a Web page the browser should display to visitors. All your text, images, forms and any other content goes between the <body> and </body> tags. WordPress segments pages so every template calls the "header.php" file containing the opening <body> tag, and every template also calls the "footer.php" file containing the closing </body> tag. You can find and edit these files by using the editor under "Appearance" in the WordPress dashboard.

  • Log into your WordPress dashboard at:

    http://yourdomain.com/wp-admin/

    Navigate to "Appearance," and then click on "Editor." You will see a code editing screen with a listing of available theme files to edit.

  • Click on the link for "header.php" in the list of files on the right-hand side. The code for your "header.php" file will load. This code is included at the top of every page of your WordPress-based website.

  • Scroll down in the code editing box until you see the <body> tag. This tag comes directly after the closing </head> tag and before any content that displays on the page, such as <div> or <header> tags. Well-coded themes should have a body_class() function within the <body> tag. If it's not already there, add it:

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

  • Click the blue "Update File" button and then click on "footer.php" on the right-hand side. Find the closing </body> tag directly above the closing </html> tag.

Tips & Warnings

  • If you add the body_class() function to your "header.php" file, then you can use CSS classes the function generates to apply styles to particular page types. This is easier than creating your own PHP conditional statements or other code.

References

  • Photo Credit Jupiterimages/Photos.com/Getty Images
Promoted By Zergnet

Comments

You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

M
Is DIY in your DNA? Become part of our maker community.
Submit Your Work!