How To Add AdSense ads between WordPress posts
|
Hello friends, adding AdSense ads between WordPress posts is quite common thing but sitll some guys are asking about this thing in some webmaster forums, so i want to give this in the following tutorial. Hear i clearly explained how to place Adsense ads between the wordpress posts,
Hear the thing is based upon our php knowledge, just i am telling you guys. All wordpress themes having home.php and index.php with the function
< ?php if (have_posts()) : ? >
<?php if (have_posts()) : ?> function will executes the all the posts for given extent so if you want to place ads in between the posts just do the following
1. Open home.php, and Find the following line
<? php if (have_posts()) : ? >
2. Above it add the following line
< ?php $count = 1; ? >
3. Now find the for line <div class="entry">
4. Add the following code below it
<? php if ($count == 1) : ?>
—– Your AdSense Code ——–
<? php endif; $count++; ? >
5. Now just update the post, and make sure that the ad has been added to the first post listing.
Remember :
To change which post your ad is placed under, simply change the count numberExample: $count == 2 will place the ad under post 2, thats change depending upon your requirement
You May Also Like
Get Updates:
| |











