Forums Forums Search & Filter Pro Show results on same page + filters not working

Viewing 10 posts - 1 through 10 (of 39 total)
  • Anonymous
    #185206

    Hey people, just bought the plugin and I’m facing some issues here.

    I’m developing an essays collection site, with over 800 philosophy essays. The main feature is the search and filter (you saw it coming, I know), so people can find what they wanna read.

    The essays are a custom post type. There’re also two more CPTs: Collections (to group essays) and Authors.

    There are plenty of ACF fields attached to these CPTs, including two relationship fields to link essays to collections and essays to authors. Another important ACF field is the publishing year (as a date picker field).

    I’ve managed to create a search form to find essays by author, publishing date or categories, and it’s set up this way:

    (general settings — Itens stands for Essays, Coleções for Collections)
    General settings

    (display settings)
    Display results

    Ok, now what’s going on

    When I make the first filter (eg.: click an author’s name), I’m redirected to a new page with results. Then, if I click any other author, the results list looks like it’s refining the search, the URL changes, but the results are still the same after the AJAX request. If I manually refresh the page with the 2-author-URL, things work how they are supposed to work: both of authors’ essays are available on results.

    What I need to be happening
    I searched on docs and tried every option to make things work, but results are not on the same page of search form and the filters are basically not working after the first action.
    The ideal scenario would be results on same page of filters and that these work properly.

    Anyone could help?

    Trevor
    #185290

    From the settings, it looks like the site is on a local install, so I cannot see it working. Is that correct?

    From what you describe, it looks like the Ajax Container settings (which is currently set to #main I can see from your screenshots) is wrong. #main is the standard container name for a list of archives results (as per the WordPress Codex), but my guess is your theme uses something else.

    If I could see the site live, then I could advise you better.

    Anonymous
    #185300

    Hello Trevor!

    You’re correct about the local installation, I’m heading to work right now and can set it online on the next hours.

    About the #main, it’s the same ID on my current installation.

    I’ll keep in touch.

    Anonymous
    #185405
    This reply has been marked as private.
    Trevor
    #185454
    This reply has been marked as private.
    Anonymous
    #185456
    This reply has been marked as private.
    Trevor
    #185468

    Ok, I have revealed the counts for now and enabled Auto Count (for the counts to work).

    Did you add some code so that the ones you select switch to the top of the list?

    Can you try this with Ajax off for now? If that works, try it with normal pagination (not infinite scroll).

    Anonymous
    #185478

    Trevor, thank you for the response!

    Yes, I added this css so the designer could stay in peace as now he knows this is possible (put selected items on top)

    I disabled Ajax and things started to work a little bit more as expected, without Ajax infinite scrolling won’t work, right? Can we make it work with Ajax?

    Trevor
    #185497

    It will be the template code for that page that is causing it not to work, most likely using either query_posts or pre_get_posts, which is overriding our filter. If this is the case, a way around this is to use the Custom display method, described here:

    https://searchandfilter.com/documentation/search-results/custom/

    Anonymous
    #185503

    Trevor, you mean the archive.php file?

    We use Auttomatic’s Underscores as base, so I believe it’s using the most “stick to the codex” code, right?

    In our case, archive.php gives this code between get_header() and get_sidebar()/get_footer():

    <main id="main" class="site-main">
    
    		<?php if ( have_posts() ) : ?>
    
    			<header class="page-header">
    				<?php
    				the_archive_title( '<h1 class="page-title">', '</h1>' );
    				the_archive_description( '<div class="archive-description">', '</div>' );
    				?>
    			</header><!-- .page-header -->
    
    			<?php
    			/* Start the Loop */
    			while ( have_posts() ) :
    				the_post();
    
    				/*
    				 * Include the Post-Type-specific template for the content.
    				 * If you want to override this in a child theme, then include a file
    				 * called content-___.php (where ___ is the Post Type name) and that will be used instead.
    				 */
    				get_template_part( 'template-parts/content', get_post_type() );
    
    			endwhile;
    
    			the_posts_navigation();
    
    		else :
    
    			get_template_part( 'template-parts/content', 'none' );
    
    		endif;
    		?>
    
    		</main><!-- #main -->
Viewing 10 posts - 1 through 10 (of 39 total)