Sunday, 24 March 2019

wp AJAX load more plugin repeating the same previous posts

I using wp ajax load more plugin While clicking the button it repeating the same previous post. How to fix it. Here I share my code in below:

<?php
       $the_query = new WP_Query( array(
       'posts_per_page'=>10,//on loading page i show 10 after click load more i want to show other posts
       'post_type'=>'post-name',
       'category_name' => 'A-E',
       'orderby'=> 'title',
       'order'   => 'ASC',
       'paged' => get_query_var('paged') ? get_query_var('paged') : 1) 
      ); 
?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

// here I print the following data

 <?php
      endwhile;
 ?>

 <?php
      echo do_shortcode('[ajax_load_more post_type="post-name" posts_per_page="10" category="a-e" button_label="Load More"]');
  ?>

can anyone fix it?



from wp AJAX load more plugin repeating the same previous posts

No comments:

Post a Comment