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

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.

Author: 2E Editorial
is a freelance web and graphic designer as well as developer. He is the author and owner of 2experts Design, a design blog with great inspirational posts. You can follow 2experts design on Twitter.
Click Here for more Updates
by 2E Editorial in Tutorials, WordPress 10

If you love it. Share it!

Discussion

  1. Arrow

    Useful post. good luck.

  2. Arrow

    Gives errors

  3. Arrow

    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 :)

  4. Arrow

    Adsense is my main source of income when making money online. nothing beats adsense when it comes to making money online.

  5. Arrow

    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.

  6. Arrow

    i love Google Adsense, it allows me to make money on my personal blog and some of my health related sites.

  7. Efrain

    Arrow

    This code does not work in IE6… any suggestions?

    Thanks

  8. Efrain

    Arrow

    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

  9. Arrow

    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.
    `

  10. Arrow

    Okay i got an ad after the first post but why not after the second post.

Trackbacks and Pingbacks

Leave a Reply