How to: Display Adsense After The First And After The Any Post In WordPress Blog

I am using this code in this blog to display adsense after first post and after any post. In this tutorial I will show you how you display Adsense after first post and after 2nd post or after any post in your blog within the Loop. In the tutorial I am use code examples to show you easy method to editing your WordPress theme.
Step 1
The step 1 is to open up your index.php file from your wordpress theme folder in your favorite theme editor such as like Dreamweaver or Notepad. Find the following line:
<?php if(have_posts()) : ?>
Step 2
Just copy and paste (below Red Bolder code lines ) like this:
<?php
$postnum = 1;
$showadsense1 = 1;
$showadsense2 = 2;
?>
<?php if(have_posts()) : ?>
Step 3
Scroll down the page and find this line:
<?php endwhile; ?>
Step 4
Just copy and paste the (below Red Bolder code lines ) like this:
<!--Google Ads Code Start Here--!>
<?php if ($postnum == $showadsense1) { include (TEMPLATEPATH . '/adsensepost1.php'); } ?>
<?php if ($postnum == $showadsense2) { include (TEMPLATEPATH . '/adsensepost2.php'); } ?>
<?php $postnum++; ?>
<!--Google Ads Code End Here--!>
<?php endwhile; ?>
Step 5 (Final)
Just make the 2 files, one is “adsensepost1.php” and 2nd is “adsensepost2.php” and Save As the files with “.php” extension,
make sure are both files put in same theme directory…. that’s it… Now Enjoy to make more money.
Related posts:
- Toggle WordPress Blog Into Supported Multiple Languages: 10 Popular Wordpress Plugins
- 10 Useful jQuery Wordpress Plugins To Enhance Your Blog
- Hybrid WordPress Theme Framework: Overview, Child Themes, Sites Showcase
- The Top 7 Quality Free WordPress Themes Released in February 2009
- Accidentally Decryption: SHORT OPEN TAG for the rescue











Discussion
Useful post. good luck.
Gives errors
Actually it works fine. When copying the code the ” ‘ ” needs to be changed to ” ‘ ”
So basically it has the incorrect ascii character when copy paste. Thanks for the code
Adsense is my main source of income when making money online. nothing beats adsense when it comes to making money online.
Adsense is the best paying make money online program on the internet. I just wish that i could increase my website traffic to high levels so that i could earn more money on Adsense.
i love Google Adsense, it allows me to make money on my personal blog and some of my health related sites.
This code does not work in IE6… any suggestions?
Thanks
Got it to work in IE by removing the last exclamation marks on the Google Ads Code Start Here & Google Ads Code End Here messages
I recently added an Adsense square ads on my travel blog. my adsense earning is still low since i dont have large volume of internet traffic yet.
`
Trackbacks and Pingbacks
Leave a Reply