How to Display / Show Ad Code only on Homepage of WordPress Blog

You can control ad placements of your wordpress blog by different ways. One of them is showing Ads only on the home page. This can be done in two ways. One by the use of a code and other by using a simple plug-in. By using this you can show or display ads only on the homepage and block ads in the internal pages.

The first method is by using PHP code. This code lets you show ads or any content only on the homepage. All you have to do is add in your advertisement code in the following way update your theme to notice the changes.

<?php if ( is_home() ) { ?>

Code you want to show on your homepage

<?php } ?>

The second method involves a wordpress plug-in. It is called as Whydowork Adsense. After you download and install the plug-in, you will be presented with lot of options. Select the ad code and make it to show only on home page and you are done.

In these ways, you can show ads only on the homepage easily. You can use these codes not just for the advertisements but also for any Java script or other code. The purpose of this tip is to show any element only on the homepage of your wordpress blog. 

Filed under: Blogging Tips
Tags: , , , , ,
June 28, 2009 by: Prasanth Chandra


Leave a Reply