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.

3 Responses to “How to: Display Adsense After The First And After The Any Post In WordPress Blog”
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
Leave a Comment