In this tutorial, I will show you how to display a div tag on the homepage of your WordPress website or blog.
- First you will need to edit the 'Header.php' file of your WordPress website. For instruction on how to edit your Header.php file using WordPress click here.
- Inside your header.php filemarkup section, enter the code:
PHP | copy code | ? 1 2 <? if (is_home()){ ?>
3 <div>
4 Hello World
5 </div>
6 <? } ?>
7 - Save your changes.
The 'is_home()' function is a built in WordPress function that checks if the visitor is on the homepage or not. This script will echo 'Hello world' only if the visitor is on the home page.
Before you post, please prove you are sentient.
Wait! The answer you gave wasn't the one we were looking for. Try another.
What is 6 * 6?