Skip to main content

In home page it loads the more post correctly. But when i use the same code for loading more post in single.phpsingle.php (i.e article page), it not loading correctly. on the intial load it shows 3 post as per the given query. if i click on load more post button it again loads the same post which already loaded. How to solve this?

Here is the java script code:

jQuery(document).ready(function($){// Infinite Scroll$('.infinite-content').infinitescroll({navSelector: ".nav-links",nextSelector: ".nav-links a:first",itemSelector: ".infinite-post",loading:{msgText: "",finishedMsg: ""}});$(window).unbind('.infscr');$(".inf-more-but").click(function(){$('.infinite-content').infinitescroll('retrieve');return false;});});

Here is the PHP and HTML code :

Here is the java script code:

<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                
">cat_name); $category_link = get_category_link( $category_id); echo esc_url( $category_link);?>">cat_name);?>
<script type="text/javascript">
    jQuery(document).ready(function($) {

        <?php $mvp_infinite_scroll <h2><a= href="<?phpget_option('mvp_infinite_scroll'); the_permalinkif ($mvp_infinite_scroll == "true") ?>"><?php{ the_titleif (isset($mvp_infinite_scroll);) { ?></a></h2>>
        // Infinite Scroll
  </div><!--related-text-->
      $('.infinite-content').infinitescroll({
      </div><!--related-text-  navSelector: ".nav->links",
         nextSelector: ".nav-links a:first",
        itemSelector: </li>".infinite-post",
        loading: {
            msgText: <"<?php esc_html_e( endwhile;'Loading wp_reset_postdata(more posts...', 'mvp-text' ); ?>>",
            
   finishedMsg: "<?php esc_html_e( 'Sorry, no more posts', 'mvp-text' ); </ul>?>"
        }
    <?php});
 $mvp_infinite_scroll = get_option $('mvp_infinite_scroll'window).unbind('.infscr'); 
 if ($mvp_infinite_scroll == "true"$(".inf-more-but") .click(function(){ 
 if       $(isset'.infinite-content').infinitescroll($mvp_infinite_scroll'retrieve');
            return false;
    });
 {   <?php } } ?>
    });
</script>

Here is the PHP and HTML code :

<div id="archive-list-wrap" class="left relative">

    <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

   <a href="#" class="inf       <ul class="archive-morecol-but"><list left relative infinite-content">

    <?php _e} else { ?>

            <ul class="archive-list left relative infinite-content">

            <?php } ?>
            
    <?php 
    $category = get_the_category($post->ID);
 'More Posts'  $name = $category[0]->cat_name; ?>
                
    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
    <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                    <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-text'mid-thumb', array( 'class' => 'reg-img' )); ?><>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                    </a>
                    <?php } ?>
                
                    <?php }if ( has_post_format( 'video' )) { ?>

                            <div class="feat-vid-but">

                            <i class="fa fa-play fa-3"></i>

                            </div><!--feat-vid-but-->

                            <?php } ?>
                    </div><!--related-img-->
                    </div><!--related-img-->
                    <div class="navclass="archive-links">list-in">
                    <div class="archive-list-text left relative">
                    <!--post date-->                                                
                    <div class="posted-date">                                                                                            
                    <span class="post-date"><time class="post-date updated" itemprop="datePublished" datetime="<?php ifthe_time('Y-m-d'); ?>"><?php the_time(function_existsget_option("pagination"'date_format')); {?></time></span>
 pagination                   </div>                              
                    <a class="post-cat-link" href="<?php $category = get_the_category($wp_query); $category_id = get_cat_ID( $category[0]->max_num_pages>cat_name ); }$category_link = get_category_link( $category_id ); echo esc_url( $category_link ); ?>"><span class="post-head-cat"><?php $category = get_the_category(); echo esc_html( $category[0]->cat_name ); ?></span></a>

                    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                    </div><!--related-text-->
                    </div>div><!--related-text-->
                </li>
                <?php  endwhile; wp_reset_postdata();?>
            
            </ul>
    <?php $mvp_infinite_scroll = get_option('mvp_infinite_scroll'); if ($mvp_infinite_scroll == "true") { if (isset($mvp_infinite_scroll)) { ?>
    <?phpif($mvp_posts_num == 3){?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
        <?php}?>
    <?php } } ?>
    <div class="nav-links">
        <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
    </div>
</div>  

In home page it loads the more post correctly. But when i use the same code for loading more post in single.php (i.e article page), it not loading correctly. on the intial load it shows 3 post as per the given query. if i click on load more post button it again loads the same post which already loaded. How to solve this?

Here is the java script code:

jQuery(document).ready(function($){// Infinite Scroll$('.infinite-content').infinitescroll({navSelector: ".nav-links",nextSelector: ".nav-links a:first",itemSelector: ".infinite-post",loading:{msgText: "",finishedMsg: ""}});$(window).unbind('.infscr');$(".inf-more-but").click(function(){$('.infinite-content').infinitescroll('retrieve');return false;});});

Here is the PHP and HTML code :

<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                
">cat_name); $category_link = get_category_link( $category_id); echo esc_url( $category_link);?>">cat_name);?>
                <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
            </div><!--related-text-->
            </div><!--related-text-->
                    </li>
                    <?php  endwhile; wp_reset_postdata();?>
            
            </ul>
            <?php $mvp_infinite_scroll = get_option('mvp_infinite_scroll'); if ($mvp_infinite_scroll == "true") { if (isset($mvp_infinite_scroll)) { ?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
            <?php}?>
            <?php } } ?>
            <div class="nav-links">
                <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
            </div>
                </div>  

In home page it loads the more post correctly. But when i use the same code for loading more post in single.php (i.e article page), it not loading correctly. on the intial load it shows 3 post as per the given query. if i click on load more post button it again loads the same post which already loaded. How to solve this?

Here is the java script code:

<script type="text/javascript">
    jQuery(document).ready(function($) {

        <?php $mvp_infinite_scroll = get_option('mvp_infinite_scroll'); if ($mvp_infinite_scroll == "true") { if (isset($mvp_infinite_scroll)) { ?>
        // Infinite Scroll
        $('.infinite-content').infinitescroll({
        navSelector: ".nav-links",
        nextSelector: ".nav-links a:first",
        itemSelector: ".infinite-post",
        loading: {
            msgText: "<?php esc_html_e( 'Loading more posts...', 'mvp-text' ); ?>",
            finishedMsg: "<?php esc_html_e( 'Sorry, no more posts', 'mvp-text' ); ?>"
        }
    });
    $(window).unbind('.infscr'); 
    $(".inf-more-but").click(function(){ 
        $('.infinite-content').infinitescroll('retrieve');
            return false;
    });
    <?php } } ?>
    });
</script>

Here is the PHP and HTML code :

<div id="archive-list-wrap" class="left relative">

    <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

            <ul class="archive-col-list left relative infinite-content">

    <?php } else { ?>

            <ul class="archive-list left relative infinite-content">

            <?php } ?>
            
    <?php 
    $category = get_the_category($post->ID);
    $name = $category[0]->cat_name; ?>
                
    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
    <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                    <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                    </a>
                    <?php } ?>
                
                    <?php if ( has_post_format( 'video' )) { ?>

                            <div class="feat-vid-but">

                            <i class="fa fa-play fa-3"></i>

                            </div><!--feat-vid-but-->

                            <?php } ?>
                    </div><!--related-img-->
                    </div><!--related-img-->
                    <div class="archive-list-in">
                    <div class="archive-list-text left relative">
                    <!--post date-->                                                
                    <div class="posted-date">                                                                                            
                    <span class="post-date"><time class="post-date updated" itemprop="datePublished" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time(get_option('date_format')); ?></time></span>
                    </div>                              
                    <a class="post-cat-link" href="<?php $category = get_the_category(); $category_id = get_cat_ID( $category[0]->cat_name ); $category_link = get_category_link( $category_id ); echo esc_url( $category_link ); ?>"><span class="post-head-cat"><?php $category = get_the_category(); echo esc_html( $category[0]->cat_name ); ?></span></a>

                    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                    </div><!--related-text-->
                    </div><!--related-text-->
                </li>
                <?php  endwhile; wp_reset_postdata();?>
            
            </ul>
    <?php $mvp_infinite_scroll = get_option('mvp_infinite_scroll'); if ($mvp_infinite_scroll == "true") { if (isset($mvp_infinite_scroll)) { ?>
    <?phpif($mvp_posts_num == 3){?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
        <?php}?>
    <?php } } ?>
    <div class="nav-links">
        <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
    </div>
</div>  
deleted 33 characters in body
Source Link
<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                
            
                
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                

cat_name ); $category_link = get_category_link( $category_id ); echo esc_url( $category_link ); ?>">cat_name ); ?>

cat_name); $category_link = get_category_link( $category_id); echo esc_url( $category_link);?>">cat_name);?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
            <?php}?>
            <?php } } ?>
            <div class="nav-links">
                <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
            </div><!--nav-links-->
div>
                </div>  
<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                
            
                
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                

cat_name ); $category_link = get_category_link( $category_id ); echo esc_url( $category_link ); ?>">cat_name ); ?>

                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
            <?php}?>
            <?php } } ?>
            <div class="nav-links">
                <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
            </div><!--nav-links-->

                </div>
<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                
cat_name); $category_link = get_category_link( $category_id); echo esc_url( $category_link);?>">cat_name);?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
            <?php}?>
            <?php } } ?>
            <div class="nav-links">
                <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
            </div>
                </div>  
Source Link

Repeating post how to solve this

In home page it loads the more post correctly. But when i use the same code for loading more post in single.php (i.e article page), it not loading correctly. on the intial load it shows 3 post as per the given query. if i click on load more post button it again loads the same post which already loaded. How to solve this?

Here is the java script code:

jQuery(document).ready(function($) { // Infinite Scroll $('.infinite-content').infinitescroll({ navSelector: ".nav-links", nextSelector: ".nav-links a:first", itemSelector: ".infinite-post", loading: { msgText: "", finishedMsg: "" } }); $(window).unbind('.infscr'); $(".inf-more-but").click(function(){ $('.infinite-content').infinitescroll('retrieve'); return false; }); });

Here is the PHP and HTML code :

<div id="archive-list-wrap" class="left relative">

                        <?php if(get_option('mvp_arch_layout') == 'Column' ) { ?>

                            <ul class="archive-col-list left relative infinite-content">

                        <?php } else { ?>

                            <ul class="archive-list left relative infinite-content">

                        <?php } ?>
            
                
            
                
                <?php 
                $category = get_the_category($post->ID);
 $name = $category[0]->cat_name; ?>
                
                    <?php global $do_not_duplicate; $mvp_posts_num = esc_html(get_option('mvp_posts_num')); $paged = (get_query_var('page')) ? get_query_var('page') : 1; query_posts(array(  'order' => 'DESC', 'orderby' => 'date', 'post__not_in' => array($post->ID),'posts_per_page' =>  $mvp_posts_num ,'category_name' => $name,  'ignore_sticky_posts'=> 1,'paged' =>$paged ));while (have_posts()) : the_post();$do_not_duplicate[] = $post->ID;  ?>
    
            <?php //global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => $mvp_posts_num   )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
            
                    <li class="infinite-post">
                    <div class="archive-list-out">
                    <div class="archive-list-img left relative infinite-content">
                <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>
                <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'reg-img' )); ?>
                    <?php the_post_thumbnail('mvp-small-thumb', array( 'class' => 'mob-img' )); ?>
                </a>
                <?php } ?>
                
                <?php if ( has_post_format( 'video' )) { ?>

                                                <div class="feat-vid-but">

                                                    <i class="fa fa-play fa-3"></i>

                                                </div><!--feat-vid-but-->

                                            <?php } ?>
            </div><!--related-img-->
            </div><!--related-img-->
            <div class="archive-list-in">
            <div class="archive-list-text left relative">
        <!--post date-->                                                
">

cat_name ); $category_link = get_category_link( $category_id ); echo esc_url( $category_link ); ?>">cat_name ); ?>

                <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
            </div><!--related-text-->
            </div><!--related-text-->
                    </li>
                    <?php  endwhile; wp_reset_postdata();?>
            
            </ul>
            <?php $mvp_infinite_scroll = get_option('mvp_infinite_scroll'); if ($mvp_infinite_scroll == "true") { if (isset($mvp_infinite_scroll)) { ?>
                <a href="#" class="inf-more-but"><?php _e( 'More Posts', 'mvp-text' ); ?></a>
            <?php}?>
            <?php } } ?>
            <div class="nav-links">
                <?php if (function_exists("pagination")) { pagination($wp_query->max_num_pages); } ?>
            </div><!--nav-links-->

                </div>

enter image description here