19
Jul

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

Display Adsense After The First Post

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:

  1. Toggle WordPress Blog Into Supported Multiple Languages: 10 Popular Wordpress Plugins
  2. 10 Useful jQuery Wordpress Plugins To Enhance Your Blog
  3. Hybrid WordPress Theme Framework: Overview, Child Themes, Sites Showcase
  4. The Top 7 Quality Free WordPress Themes Released in February 2009
  5. Accidentally Decryption: SHORT OPEN TAG for the rescue

Click Here for more Updates

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

Trackbacks and Pingbacks

Leave a Reply