How To : Place Adsense After The First Post
ADVERTISEMENTS
With many way monetize a blog, we need to place our ads in different positions, one place is the right after the first post on the homepage.To place a banner or an adsense ad right after the first post follow these steps.
<?php if (have_posts())
- Before that add these lines of code
<?php $count = 1; ?> -
Next find, this line
<?php the_content() ?>
<?php if ($count == 1) : ?>
Adsense/Banner Ad Code Goes Here
<?php endif; $count++; ?>
You can also change the count value in Step 3 and 5, to 2 if you want to have the ad after the 2nd post.
























Friday, July 18th, 2008 at 6:54 pm
Good one.. I am still tryin to learn all the wp loops in wordpress..
Friday, July 18th, 2008 at 8:33 pm
I had implemented this when I used my previous theme.
Friday, July 18th, 2008 at 10:46 pm
@RockStar Sid : This is something I learnt recently and wanted to share with you all.
@Nirmal: Thanks for the comment nirmal, I hope you release your old theme it was really a nice theme.
Saturday, July 19th, 2008 at 8:57 pm
nice trick
I now use OIO publsiher