Forums › Forums › Search & Filter Pro › Results are not loading
- This topic has 11 replies, 2 voices, and was last updated 9 years, 1 month ago by
Ross.
-
Anonymous(Private) March 15, 2016 at 5:17 pm #39455
Hello,
I’ve used your’re plugin before and it worked great, thank you for that. However on another project I’m working now i’ve run into a problem. When clicking on a filter the page fades out but the results are not filtered. In the console I get the following error:
jquery.min.js:4 GET http://wederopbouwvansalland.nl/boerderijen/lijst/_sft_gemeente=hellendoorn 404 (Not Found)
Settings for displaying results
The website page:
http://wederopbouwvansalland.nl/boerderijen/lijst/Thnx in advance!
Ross Moderator(Private) March 16, 2016 at 9:34 am #39509Hey Kris
Do you not see an error message at the top of that page?
There should be one showing, saying that you do not have a valid
Results URL
– this is causing malformed URLs which gives you a 404.Thanks
Ross Moderator(Private) March 16, 2016 at 3:14 pm #39546I can see in that screenshot, you have not filled in your Results URL.
If you are not getting an error message, you may be using an old version of S&F.
Info on the results URL – https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/
Thanks
Ross Moderator(Private) March 16, 2016 at 10:52 pm #39606Hey Kris
Do you want to use S&F with some custom loop on that page?
This is fairly undocumented (its a new, pretty silently added option in the last update) – but I can show you how to hook that up if necessary.
Otherwise, I would say to use the shortcode method, and customise the output of results following the instructions here:
Thanks
Anonymous(Private) March 17, 2016 at 6:53 am #39621I would like to see the custom option. Here’s the current code with custom post loop:
<div id="filters"> <h6>Filters</h6> <?php echo do_shortcode( '[searchandfilter id="116"]' ); ?> </div> <div id="page-content"> <div id="main"> <?php $args = array( 'post_type' => 'boerderij', 'posts_per_page' => 0, 'suppress_filters' => true, 'post_status' => 'publish' ); query_posts( $args ); while ( have_posts() ) : the_post(); $image_id = 77; $image = wp_get_attachment_image_src( $image_id , 'thumbnail', false ); ?> <div class="boerderij inc-inhoud"> <a href="<?php the_permalink(); ?>"> <div class="image"> <img src="<?php echo $image[0]; ?>" alt="#"> </div> <div class="text"> <h2><?php the_title(); ?></h2> <ul> <li>Lorem ipsum dolor.</li> <li>A, eos, eligendi. Lorem ipsum dolor sit amet.</li> <li class="inhoud"><span class="interview">Interview</span><span class="dossier">Hersteldossier</span></li> </ul> </div> </a> </div> <?php endwhile; ?> </div><!-- #main --> <div class="pagination"> <?php next_posts_link( "Volgende" ); ?> <?php previous_posts_link( "Vorige" ); ?> </div> </div><!-- #page-content -->
Ross Moderator(Private) March 17, 2016 at 9:40 am #39633Hey Kris
Instead of:
$args = array( 'post_type' => 'boerderij', 'posts_per_page' => 0, 'suppress_filters' => true, 'post_status' => 'publish' ); query_posts( $args );
You can simply use:
do_action('search_filter_query_posts', 96);
Ref – https://www.designsandcode.com/documentation/search-filter-pro/action-filter-reference/#Query_Posts
Alternatively, you could attach S&F to your existing query (of course update the S&F ID):
$args = array( 'post_type' => 'boerderij', 'posts_per_page' => 0, 'suppress_filters' => true, 'post_status' => 'publish', 'search_filter_id' => 123 ); query_posts( $args );
However, S&F will replace nearly all parameters from the query with its own, so your post type will be overwritten, posts per page and post status etc…
So it probably easier using the S&F action I mentioned above as the rest becomes fairly pointless. 😀
Official write up on all of this coming in the next few weeks.
Thanks
-
AuthorPosts