Show Different Header for Different Pages in WordPress
I wanted to choose a different header for my home page and for my internal post pages in WordPress. Objective was to show a particular advertisement in home page and hide it in other page. You can use this code to show different graphics on different pages also.
I used a conditional tag ‘IF’ to solve my problem. Just insert following code in your header.php file.
<?php if(is_home()) {
echo ‘HTML CODE‘;
}?>
In place of HTML CODE just put code to display any graphics that you want to display in home page but not on other pages, and you are done. Check the below the screen shots from www.crazubulb.com. Notice the Yellow rectangle. It shows that home page displays the image ad whereas other pages not.
Note:Don’t remove single quotes ‘HTML CODE‘. Just replace HTML CODE between single quotes.
You can also use is_page(‘#’) instead of is_home(), if you want to select any particular page, you need to replace # with the page id. If you want more options on conditional tag, you can visit wordpress codex. Please feel free to ask if you have any query regarding this.
daily email newsletter
Recent Posts
- 5 Useful Tools to Recover Lost Data
- Angry Bird for all – on Multiple Platforms
- Google Docs:Excellent Tool Managing Documents Online
- Ways to open .Psd File without installing Photoshop .
- How To Invite Facebook friend To Google Plus,with Simple Steps .


