Support Forums

Looking for support? You can access the support system via your account.

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

Viewing 8 posts - 1 through 8 (of 8 total)
  • Tricia Francis
    #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!

    Tricia Francis
    #194759
    This reply has been marked as private.
    Trevor Moderator
    #194792
    This reply has been marked as private.
    Tricia Francis
    #194845
    This reply has been marked as private.
    Trevor Moderator
    #194848
    This reply has been marked as private.
    Tricia Francis
    #194850
    This reply has been marked as private.
    Trevor Moderator
    #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
    }
    ?>
    Tricia Francis
    #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)

The topic ‘Infinite scroll works – but just once’ is closed to new replies.