1
votes

I have installed infinite ajax scroll on my wordpress blog and it's working fine.

The one thing I'm having trouble with is I have my posts set up to add in some content every 2nd post. This works fine on the first page, but as soon as the infinite scroll kicks in, it doesn't load the content every 2nd option anymore.

I'm not very clever at javascript and would appreciate any tips you can send my way. I have read that I can use onRenderComplete: however I'm not sure how to actually implement this on the page.

my current code calls in the post like this:

    <?  $count = 0;
    if ( have_posts() ) : while ( have_posts() ) : the_post();

    if ($count % 2 == 0){?>
    ADD Content
  <?php }
  $count++;
   ?>

and then after that is my normal post function.

At the very end I have this:

   <script type="text/javascript">
var ias2 = $.ias2({
  container: ".col1",
  item: ".posthp",
  pagination: ".pagenavi",
  next: ".nextpostslink"
});

ias2.extension(new IASTriggerExtension({offset: 10}));
ias2.extension(new IASSpinnerExtension());
ias2.extension(new IASNoneLeftExtension({html: '<div style="text-align:center"><p><em>No More Posts</em></p></div>'}));

Appreciate any help at all thanks.

Carly

1

1 Answers

0
votes

Wrap the content you add every two items in an element with the class posthp.