How to Insert Ads Between First Post and Second Post in WordPress?

Mrinmay Bhattacharjee | January 20, 2009 More


A Few Days Back I wrote about How to Remove WordPress Theme Sidebars and Integrate Google Adsense Search within your Blog.

insert-post-between-first-post-and-second-post

Now Here’s another small Template Hack/Trick for Displaying Advertisement Between First Post and Second Post in WordPress (Refer Image above).

Follow these simple steps:

  • Navigate to Design/Appearance Tab
  • Choose Theme Editor
  • Go to Index.php
  • Now search for the following line in it:

<?php endwhile; ?>

  • Now Immediately above this place the following lines:

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

  • Moreover, you can align the placement of this Advertisement to Center simply by using <center> tag as shown below:

<center>

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

</center>

It’s all Done.

Note: This template trick/hack is only applicable for WordPress Self Hosted Blog Users, this will not work for Blogs hosted on WordPress.com

[via]

Category: How To, Tutorial, Web, Wordpress

Comments (2)

  1. Ajinkya says:

    hey thanks,

    i done this tut, it helped me. u can chk the DEMO here: http://gfxtutor.co.cc/?p=15

    cya

  2. Southspice says:

    Nice tips with easy understanding is the highlight of this article. Better I bookmark this page @ http://desidigg.slinkset.com for all my friends & members of this site.