Display Ads in WordPress Only After First Post


If you ever tried to insert a piece of code or advertisement code in WordPress loop, you must have realized it would have shown after every post. With this simple hack you can show your ad code, whether it be Google Adsense or any other code, to show only after first post.

Procedure:

Note: Do take backup of your theme before you try this.

01. In your WordPress Admin panel go to Appearance => Editor.

02. Then choose header.php file from right hand side and add search for this code:

<?php endwhile; ?>

And add below code (replaced with your ad code) immediately before above code:

<?php if(!$show_ads){ ?>
Insert Code Here
<?php $show_ads = 1; } ?>

03. Replace Insert Code Here with your ad code. This concludes this simple and useful tutorial. Hope you like it.

  • Halaman

  • October 2010
    M T W T F S S
    « Sep   Nov »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • RSS 20 Newest Free

  • RSS Brothersoft

  • RSS New Software

  • AntiVirus

  • Status Anda

    IP
  • Pengunjung

    free counters
  • Blog Stats

    • 328,581 hits
  • Add to Google Reader or Homepage Subscribe in NewsGator Online Add to netvibes Subscribe in Bloglines Add to fwicki Add to Webwag Powered by FeedBurner

  • Friends Link

  • RSS Kompas

    • An error has occurred; the feed is probably down. Try again later.
  • RSS Lowongan Kerja Terbaru 2013

    • An error has occurred; the feed is probably down. Try again later.
  • RSS Loker.id

  • Info Tentang AQ

  • Meta

  • %d bloggers like this: