Adsense inline your Wordpress Blog posts

I stumbled upon this very handy guide on how to insert an adsense ad unit after the first post on your wordpress blog.

To do this you will need to be able to edit the template files, specifically the “index.php” file.
The guide uses a simple PHP if statement to count the number of posts and insert the adsense code after the first post (or second or third etc).

Open up the template file index.php in your favourite text editor and add this to the top.


In the index file there is a “while” loop that grabs all the needed wordpress posts.
It starts with this

and ends with

Just before this “endwhile” statement, we need to add some code.


And your done!

Read more about tips on adding Adsense to your blog.

No related posts.

Have a computer problem? Ask in our SUPPORT forum!

Receive Discounted Software

No bull. Want cheap discounts for common software products?
  • AntiVirus
  • Video editing tools
  • Web development tools
  • Registry Cleaners
  • Computer speed boosters!
Our editors get these products sent to us WEEKLY for review.

WE WANT TO PASS THESE DISCOUNTS ON TO YOU! (We honestly don't need them)

So whack your email in the box below and when we receive stuff we'll forward it to you! Its that simple.


Leave a Reply