Forums Forums Search & Filter Pro Infinite Scroll issues

Viewing 7 posts - 1 through 7 (of 7 total)
  • Anonymous
    #153212

    Hello, hope you can help.

    I have created multiple Search & Filter forms for custom post types and taxonomies, and am displaying them on various pages using shortcodes. These are all using custom results.php files that I made in the child themes “search-filter” folder which are working with no issues, however I can’t get the Infinite Scroll working on any of these.

    I have created a new Search & Filter form for testing purposes using WP blog posts as results, with Ajax turned on and Infinite Scroll selected. This form is using the standard results.php file in the plugin’s directory as I have not created a custom results.php file for it. Outputting the results on to a new page using a shortcode and scrolling to the bottom does not load any further results – it only dislays an “Older Posts” pagination link.

    Screenshots of the form settings below:

    https://prnt.sc/i24b1d
    https://prnt.sc/i24b7w

    I can send you a link to the page in question too if that would help?

    Let me know if you need more information.

    Kind regards,
    Prag Support

    Trevor
    #153254

    You will need to follow the instructions for making a custom results.php file here:

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    However, you need to change the contents of the standard results.php file to the content of the infinite scroll version, which look like this:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    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
    #153258

    Hi, thanks for coming back to me.

    For one of the custom results.php files I have used the infinite scroll version, my code looks like this (below).

    I have also used a form without a custom results.php file, so it should have used the standard results.php file stored within the plugin.

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * Note: these templates are not full page templates, rather 
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think 
     * of it as a template part
     * 
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs 
     * and using template tags - 
     * 
     * http://codex.wordpress.org/Template_Tags
     *
     */
    
    if ( $query->have_posts() )
    {
    	?>
    
    	<div class="filter-grid">
    	
    		<div class='search-filter-results-list'>
    		<?php
    			while ($query->have_posts())
    			{
    				$query->the_post();
    				
    				$thumb_url = get_post_meta( get_the_ID(), 'news_thumbnail', true );
    				$link = get_post_meta( get_the_ID(), 'news_link', true );
    
    				if ( empty($link) ) {
    					$link = get_the_permalink();
    				}
    				?>
    
    				<div class="x-column x-sm x-1-3 item">
    				  <div class="category"><?php echo get_the_term_list(get_the_ID(), 'news', '', ', ', ''); ?></div>
    				  <a href="<?php echo $link; ?>">
    				    <div class="image">
    				      <img src="<?php echo $thumb_url; ?>" width="100%" />
    				    </div>
    				    <div class="content">
    				      <h3><?php the_title(); ?></h3>
    				      <p><?php echo get_the_date( 'd.m.y' ); ?></p>
    				    </div>
    				  </a>
    				</div> <!-- .item -->
    				
    				<?php
    			}
    		?>
    		</div> <!-- .search-filter-results-list -->
    
    	</div> <!-- #filter-grid -->
    <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
    Trevor
    #153264
    This reply has been marked as private.
    Anonymous
    #153276
    This reply has been marked as private.
    Trevor
    #153293
    This reply has been marked as private.
    Anonymous
    #153314

    Thank you, that has solved the issue!

    For anyone else with a similar issue – the full URL path must be used in the Results URL field.

Viewing 7 posts - 1 through 7 (of 7 total)