Inserting google ads between posts in a wordpress site with infinite scroll

I am trying to insert google ads between every 5 posts in my wordpress site with infinite
scroll.

This is the code I am using to add the google ads between every 5 posts

Read More
if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post();
    //before 
    if (($count>1) && ($count%5 == 0) ){ ?>
      <div>
        [adcode] 
      </div> 
   <? }
    $count++;

The code works for first sets of posts loaded but it does not work with infinite scroll.
The infinite scroll loads the next set of posts without the google ad.

This is the site i am working with http://bluehandwebdesign.com/dev/hk/

This is the reference site http://terra.com/

Can you help?

Related posts

Leave a Reply

1 comment

  1. Is far as I know:
    You are not allowed to do this. There is a maximum of 3 ads per page and you don’t want your account suspened 🙂