How to add adsense after first post on Homepage, Category Tag Pages

Right ads at right place ensures higher CTR  thus a chance to earn more. We all take care for having the ads at its best possible location, here we will discuss more about such possible  ads places and how to implement it in your wordpress blog.Adsense ads or any other network ads after single post can be the right choice to deal with. On Homepage or on category page or on tag page we have numbers of post (in most cases 7-10) on single page. Many of us concentrate on sidebar, header, footer or customizing ads in single page but fewer of them are worried about ad position on page where there are multiple posts.

How to add adsense or any html code after first post?

Step I : Go to WordPress Dashboard >>Appearance >> Editor.

Step II: Select the page to be edited say Home page ,category page or tag page (Here we will discuss about Home page i.e., index.php click on it)

Step III: Search for following php tag just press CTRL + F

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Step IV : Add  following code before above as

<?php $bscount = 1; ?>

Step V:  Now look for   <?php endwhile; else: ?>  and place <?php $bscount++; ?> above it.

Step: VI : Finally place this code where you want your ads to be appeared between Step IV and V

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

<!– Your HTML/Adsense code here –>

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

If you want do display ads after 2nd or 3rd post then you just have to replace “1” by either 2 or 3 or with any no as per your requirement in all php tag showing “bscount == 1”.

Click Here to Leave a Comment Below 15 comments
Ruchi - January 18, 2010

Nice post , for all adsense beginners.

Reply - February 10, 2010

thanks for the advice, I’ll try it

niftyfutureking - May 13, 2010

very useful info, thanks a ton, just the exact thing i was searching for..

Christian - May 29, 2010

it doesn’t work for me. I can’t find some of the codes.. Maybe because of my theme.

    Rohit Langde - May 29, 2010

    No matter whatever theme you use, Some codes like for “Post content” and all are similar. Please look at it again and you will get it for sure.

rez - August 25, 2010

My blogs disapprove ad sense .Please help.

StrengthSource - August 28, 2010

Thanks for your useful article. It works ! I never thought it would have been this easy. Your explanation was really clear. Thanks.

    Nitin - August 29, 2010

    Thanks for your comment

iraq4ll - September 21, 2010

good info
put adsense ads in php or html template easy
because we can understand the codes

Way 2 Read News - December 15, 2010

Hi Nitin your tips is very nice but i have 1 query,
How to add adsense code single post in blogspot domain?
please reply soon as possible.

ApnaBroadband - December 23, 2010

I dont know why, but it’s not working for me , I am doing some mistake.

dharmendra - January 10, 2011

how to get google adsense approvel.

muhammad waqas-19883 - February 7, 2011

thank you for useful information about will help me to earn extra income from adsense.

sanjeev - February 8, 2011

Nice post. really helpful for me. i was searching for that code. Thanks.

Pavan Somu - May 13, 2012

Thanks a lot for the code.


Leave a Reply: