WP Hack: Adding banner (ad) after the first post

Posted in » WordPress - by Ades on December 24th, 2007

Sometimes you just want to add one ad (banner) in your blog, and you want it to be after the first post. If you wanted to do that, here is a quick fix:

wordpress, adding banner ad after the first post

As you can see from the screenshot above, you will need to find your “Read More” code in index.php (Presentation > Theme Editor > Main Index Template). After you have found it, insert this code below:

<?php if ($count == 0) : ?>

paste your ad code here

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

Replace the text “paste your ad code here” with your own ad code and save your index.php.

That’s it! This small code will display your ads after the first post only.

Thanks to onemansblog.com

[Post to Twitter]  [Post to Delicious]  [Post to Digg]  [Post to StumbleUpon] 


Related Posts




12 Responses to “WP Hack: Adding banner (ad) after the first post”

  1. By xBrain on Dec 24, 2007

    Hi Ades,

    Thanx for the tips. I had search this info for quite sometimes. Need to put the nuffnang ads.

    Btw Ades, I had a talk with Tim about the nuffnang ads are not done well in your blog and he says because the unique visitors that you received mostly from outside, not local.

    Hope that info will help..

  2. By Shawal on Dec 24, 2007

    Thanks Ades for this simple tutorial.. I’ve been looking for this a quit time….

  3. By Ades on Dec 25, 2007

    xBrain, yes that might be the case with nuffnang. But anyway the performance was still weak compared to other programs.

  4. By Michael on Jan 3, 2008

    Implemented on my blog immediately, wonderful tip!

  5. By Make Money Online on Feb 21, 2008

    Top tip. Just got to find that code now. LOL

  6. By FACTOR2 on Feb 29, 2008

    Thank You.Good script

  7. By PS3 on Mar 14, 2008

    Thanks for the heads up, that will sure save a bit of time.

  8. By Sebastian on Oct 31, 2008

    But how to make this ad visable just on home page not on older entries?

    Anyone can help

  9. By clickonpost on Nov 16, 2009

    Thanks its helps. More tip like this short and easy to understand :)

  10. By Faydaliweb on Nov 19, 2009

    Thanks for modification. Bythe way adsense manager plugin can be used more detailed adsense placements

  11. By haber on Nov 25, 2009

    very wise idea.I plan to use for adsense.thanx adesblog:)

  12. By Ruben | OurBlogLog on Jan 6, 2010

    very useful tip , thanks ades


Post a Comment