Ads after the first post in wordpress on homepage
Have you ever wondered how to place ads after the first post in wordpress ? You want to get the ads between the first and second post ? Then read on to see how it is done. I promise it is quite simple.
One of the more effective places to implement Google Adsense is after the first post. My personal favorite is the 336×280 after the 1st post. You will also see that the CTR for ads in this spot is usually higher than placing it on the sidebar.
Step 1 :
Open up index.php or home.php in your favorite Editor.
Step 2 :
Look for
<?php if (have_posts())
and add this before that line
<?php $count = 1; ?>
What It Does :We are adding a counter so that we can call the ads after say x number of posts
Step 3 :
Now you have to find
<?php the_content
and immediately after that , add:
<?php if ($count == 1) : ?> REPLACE THIS WITH YOUR ADSENSE CODE <?php endif; $count++; ?>
What It Does :We are asking wordpress to inject the Adsense Ads when the counter is set to 1, as so now we get the ads after the 1st post. want it after the 3rd post ? change $count == 1 to $count == 3
TIP : Want to add ads after the 1st 2nd and 3rd post ? Replace
<?php if ($count == 1) : ?>with
< ?php if ($count == 1 || $count == 2 || $count == 3) : ?>
One key point to note is that this hack should go inside the loop otherwise it won’t come out the way you want it.
Hope this helps you guys. If you are having any issues with this feel free to use the comments section for help.





