Friday, September 14, 2007

How to add your AdSense ads after the first post on Wordpress

I was looking for a plugin or tutorial to do this , but due to the fact that I couldn’t find any plugins I started searching more and more for a code to satisfy my needs . Today I found it , and I am going it to share it . So , here it is :

Go into the WordPress control panel > Presentation > Theme Editor

and find the following code :

< ?php if (have_posts())

above that , add :

< ?php $count = 1; ?>

Then find the line that starts with:

< ?php the_content

and add :

< ?php if ($count == 1) : ?>

Your Google AdSense code

< ?php endif; $count++; ?>

If you wanted to make it after the 2nd post, change “count == 1″ to “count == 2″. It’s as easy as it looks like .

1 comments:

CristianR said...

Wow, thanks for stealing my article! It's a really great one.