Ajax Load More returning Duplicate Items
-
I have a page using Ajax Load More to return posts in a custom post type. When multiple pages load, some posts are duplicated several times.
Here is my page’s code:
<?php /* Template Name: Client List Page */ get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div id="content"> <section id="mainContent"> <?php include('library/snippets/featured-image-space.php'); ?> <div id="mainContentHolder"> <div id="inner-content" class="wrap cf"> <?php include('library/snippets/parent-title.php'); ?> <main id="main" class="m-all t-2of3 d-5of7 cf" role="main" itemscope itemprop="mainContentOfPage" itemtype="https://schema.org/Blog"> <div class="entry-content"> <?php include('library/snippets/page-title.php'); ?> <div class="contentColumns"> <?php the_content(); ?> </div> </div> </main> </div> </div> </section> <?php include('library/snippets/flexblockLoader.php'); ?> <section id="clientList"> <div class="wrap"> <?php if(get_field('qd_client_list_title')){ ?> <h1><?php echo get_field('qd_client_list_title'); ?></h1> <div class="shortHR redHR"></div> <?php } ?> <div id="clientFilters"> <?php $industries = get_terms('qd_client_industry'); if($industries){ ?> <div class="clientFilterHolder"> <select id="industryFilter"> <option value="" disabled selected>Industry</option> <option value="all">See all Industries</option> <?php foreach($industries as $industry){ echo '<option value="'.$industry->slug.'">'.$industry->name.'</option>'; } ?> </select> </div> <?php } ?> <?php $functions = get_terms('qd_client_function'); if($functions){ ?> <div class="clientFilterHolder"> <select id="functionFilter"> <option value="" disabled selected>Function</option> <option value="all">See all Functions</option> <?php foreach($functions as $function){ echo '<option value="'.$function->slug.'">'.$function->name.'</option>'; } ?> </select> </div> <?php } ?> </div> <div id="clientList"> <?php echo do_shortcode('[ajax_load_more container_type="div" repeater="template_2" post_type="qd_client" posts_per_page="15" orderby="menu_order"]'); ?> </div> </div> </section> <?php include('library/snippets/footer-widget.php'); ?> </div> <?php endwhile; endif; ?> <?php get_footer(); ?>
For easier viewing, here is the shortcode being used:
[ajax_load_more container_type="div" repeater="template_2" post_type="qd_client" posts_per_page="15" orderby="menu_order"]
The repeater template being used is this:
<div class="singleClient"> <?php $thisLogo = get_field('qd_client_logo'); ?> <img src="<?php echo $thisLogo['sizes']['client-logo']; ?>" alt="<?php echo $thisLogo['alt']; ?>" /> </div>
Any thoughts on what’s happening and how to fix it?
The page I need help with: [log in to see the link]
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Ajax Load More returning Duplicate Items’ is closed to new replies.