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:
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.
- Photo Credit Jupiterimages/Photos.com/Getty Images
How to Center Headers in CSS on WordPress
The header.php file of a WordPress theme contains that theme's code. At a bare minimum, this code includes both HTML and PHP...
How to Edit a WordPress CSS File
CSS, or Cascading Style Sheets, are the building blocks that store the elements of your Web site's appearance, such as colors and...
How to Edit Wordpress Themes
If you host your own Wordpress.org Blog then you will have complete access to edit and customize your Wordpress Themes. However, if...
How to Add Tracking Code To Wordpress
Adding a tracking code to a Wordpress site is relatively quick and easy to do. A tracking code allows you to track...
Changing the Color of WordPress Theme
When you finally find the perfect WordPress layout, you shouldn't let the wrong color scheme stop you from picking it up. So...