Support Forums

Support Forums Forums Search & Filter Pro double load effect when there is only one page of results

This topic is: not resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Jonathan Hatch
    #234506

    Hi,

    I’m having trouble preventing the double load effect when there is only one page of results. When there are multiple pages, the span with the data attribute works well. Example: https://abe.stpaulmedia.net/ But when there is only one page, the spinner appears if you scroll. Example: https://abe.stpaulmedia.net/?_sft_focus=civics-citizenship

    The display results method is custom, and I’m using the template engine Twig via the plugin Timber. Here are the relevant bits:

    functions.php

    function spm_modify_blog_homepage_query( $query ) {
    	if ( ! is_admin() && $query->is_home() && $query->is_main_query() ) {
    		$sf_id = get_field( 'sf_id', 'option' );
    
    		$query->set( 'orderby', 'title' );
            	$query->set( 'order', 'asc' );
    		$query->set( 'search_filter_id', $sf_id );
        }
    }
    add_action( 'pre_get_posts', 'spm_modify_blog_homepage_query' );

    index.php

    $context = Timber::context();
    
    $context['catalog_search_form'] = Timber::get_widgets( 'catalog-search-form' );
    $context['posts'] = new Timber\PostQuery();
    $context['pagination'] = Timber::get_pagination();
    
    $templates = array( 'index.twig' );
    
    Timber::render( $templates, $context );

    index.twig

    <div class="ajax-container">
    	<div class="is-container">
    		{% if posts %}
    			{% for post in posts %}
    				{% include 'blocks/preview.twig' %}
    			{% endfor %}
    		{% endif %}
    
    		{% if pagination.current == pagination.total %}
    			<p data-search-filter-action="infinite-scroll-end">End of results</p>
    		{% endif %}	
    	</div>
    </div>

    I tried searching the forums but didn’t find this specific issue. Thanks for taking a look, and let me know if you need more info.

    Trevor Moderator
    #234553
    This reply has been marked as private.
    Jonathan Hatch
    #234628
    This reply has been marked as private.
    Jonathan Hatch
    #235001
    This reply has been marked as private.
    Ross Moderator
    #235131
    This reply has been marked as private.
    Ross Moderator
    #235238
    This reply has been marked as private.
    Jonathan Hatch
    #235364
    This reply has been marked as private.
    Ross Moderator
    #235408

    Hi Jonathan

    Just to confirm that all worked ok and I can close this thread?

    Thanks

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

You must be logged in to reply to this topic.