WordPress Tricks

Filter adsense not to show in Home page posts :How to Use adsense in individual post but dont show them in home page

Few days ago i faced a problem where my client asked me to solve this small issue. Client asked me
that he wants to use adsense in individual posts, but as that posts are showing in home page also
he don’t want that adsense to show in home page as google has some restrictions

Here is how i have solved it.. if you have any solutions which seems better feel free to share..

Step 1 : At first download and install this plugins in ur wordpress site


This plugins will help u to implement or use php code in posts, pages and widgets

Step 2 :

It is the main part and the most easiest part… the adsense code which u want to use, you need to wrap it with following
php code

Here is the outline

 <?php if(!is_home()||!is_front_page()) {?>     


<?php }?>

To get clear idea pls see this image

So, the adsense code will look like the followng and use it in your posts

<?php if(!is_home()||!is_front_page()) {?>

<script type="text/javascript">

google_ad_client = "ca-pub-9589296112105193";
google_ad_slot = "2495089172";
google_ad_width = 300;
google_ad_height = 250;
</script><br />
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

<?php }?>

Now you are done… the adsense will now show only in individual posts page but not in home page.

You can take my personal help in skype : om2000_cuet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s