Forums › Forums › Search & Filter Pro › Show results on same page + filters not working
Tagged: filters not working, same page results, V3
- This topic has 38 replies, 2 voices, and was last updated 6 years, 10 months ago by
Anonymous.
-
Trevor(Private) August 13, 2018 at 12:16 pm #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.
Trevor(Private) August 14, 2018 at 1:15 pm #185468Ok, 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(Private) August 14, 2018 at 1:38 pm #185478Trevor, 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(Private) August 14, 2018 at 2:36 pm #185497It 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(Private) August 14, 2018 at 2:56 pm #185503Trevor, 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()
andget_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 -->
-
AuthorPosts