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”.


About the Author

Nitin Sapkal is tech enthusiastic Blogger from Nagpur. Being an ETC Engineer he covers the News related to Telecom field along with gadgets reviews and general tricks & hacks.

15 Enlightened Replies

Trackback  •  Comments RSS

  1. Ruchi says:

    Nice post , for all adsense beginners.

  2. thanks for the advice, I’ll try it

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

  4. Christian says:

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

  5. rez says:

    My blogs disapprove ad sense .Please help.

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

  7. iraq4ll says:

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

  8. 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.

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

  10. dharmendra says:

    how to get google adsense approvel.

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

  12. sanjeev says:

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

  13. Pavan Somu says:

    Thanks a lot for the code.

Post a Reply

Your email address will not be published. Required fields are marked *