Infinite scroll works – but just once

Forums › Forums › Search & Filter Pro › Infinite scroll works – but just once

  • This topic has 7 replies, 2 voices, and was last updated 8 years ago by Anonymous.
Viewing 8 posts – 1 through 8 (of 8 total)
  • Anonymous
    #194758

    Hey!

    I have a filter set up for a portfolio and want to use infinite scroll. I’ve followed your guidelines on setting up for both infinite scroll and post type archives, but I only get one set of additional posts. By this, I mean 12 posts are initially loaded, and when I scroll I get 12 more posts – but that’s it – no more posts as I continue to scroll. There should be 120+ posts.

    Here is the archive template code:

    <?php
    /**
     * The template for displaying portfolio archive pages.
     *
     * @package WPGood
     */
    
    $intro = get_field('introductory_text', 4097);
    $archive_title = get_the_title(4097);
    get_header(); ?>
    
    	<main id="main" class="content-area" role="main">
    
    	<?php if ( have_posts() ) : ?>
    
    		<header class="page-header">
    
    			<h1 class="page-title"><?php echo $archive_title; ?></h1>
    
    			<div class="gallery-intro">
    				<p><small>Updated <?php the_modified_date(); ?></small></p>
    				<?php echo $intro; ?>
    			</div>
    
    		</header><!-- .page-header -->
    
    		<div class="gallery-filter">
    
    			<?php echo do_shortcode('[searchandfilter slug="portfolio-filter"]'); ?>
    
    		</div>
    
    		<div class="gallery-posts">
    
    			<?php while ( have_posts() ) : the_post();
    
    				get_template_part( 'template-parts/content', 'gallery-summary' );
    
    			endwhile; ?>
    
    			<span class="gallery-end" data-search-filter-action='infinite-scroll-end'>No more results</span>
    
    		</div>
    
    		<?php else :
    
    			get_template_part( 'template-parts/content', 'none' );
    
    		endif; ?>
    
    	</main><!-- #main .content-area -->
    
    <?php get_footer();
    

    The template part for gallery summary is wrapped in an article tag, which I have set as the
    Post / Result Selector.

    Hopefully I’m not missing something silly… any help would be most appreciated.

    Thanks!

    Anonymous
    #194759
    This reply has been marked as private.
    Trevor
    #194792
    This reply has been marked as private.
    Anonymous
    #194845
    This reply has been marked as private.
    Trevor
    #194848
    This reply has been marked as private.
    Anonymous
    #194850
    This reply has been marked as private.
    Trevor
    #194896

    I made a couple of minor changes, but to no avail. I think it is the structure of the PHP in your template. See here what our exemplar structure looks like:

    if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Results<br />
    	<div class='search-filter-results-list'>
    	<?php
    		while ($query->have_posts())
    		{
    			$query->the_post();
    			
    			?>
    			<div class='search-filter-result-item'>
    				<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    				
    				<p><br /><?php the_excerpt(); ?></p>
    				<?php 
    					if ( has_post_thumbnail() ) {
    						echo '<p>';
    						the_post_thumbnail("small");
    						echo '</p>';
    					}
    				?>
    				<p><?php the_category(); ?></p>
    				<p><?php the_tags(); ?></p>
    				<p><small><?php the_date(); ?></small></p>
    				
    				<hr />
    			</div>
    			
    			<?php
    		}
    	?>
    	</div>
    <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
    Anonymous
    #195281

    We resolved this by updating:

    <div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'> <span>End of Results</span> </div>

    to:

    <div class='search-filter-results-list'> <span>End of Results</span> </div>

    This goes against documentation, but worked.

Viewing 8 posts – 1 through 8 (of 8 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.