Forums › Forums › Search & Filter Pro › Search result filtering
Tagged: ajax, query-update
- This topic has 23 replies, 2 voices, and was last updated 9 years, 10 months ago by Ross.
-
Anonymous(Private) November 26, 2014 at 1:07 pm #8236
Hi,
I’m building a site, with a custom search.php file, where the intention is that people can narrow their search results (through search and filter pro).
An example search is here: http://meridian-trust.co.uk/meridian_site/?s=consectetur&post_type=video
Now, If you click “Refine Search” on the right, there’s your plugin working – However, it’s not ajax loading the results, and even if i disable ajax, it not updating the query – it’just shows the same results. Any help here?
Ross Moderator(Private) November 26, 2014 at 5:21 pm #8249Hi Jan
I’m guessing you have a custom query in your results template? Something like
query_posts
,get_posts
orWP_Query
?You template must not have a custom query inside as otherwise this query will override the search results.
Thanks
Anonymous(Private) November 26, 2014 at 8:42 pm #8261Hi again,
No, I’m not using a custom query inside mu search.php
My file looks like this:
<?php /** * @package WordPress */ get_header(); ?> <?php $total_results = $wp_query->found_posts; ?> <section class="content search-results"> <div class="wrapper"> <?php if ( have_posts() ) : ?> <h2><?php echo $total_results ?> Search results for:</h2> <div class="query"><?php the_search_query(); ?></div> <div class="sort-results desktop"> Sort results by: <div class="sort-links"> <a href="#">Relevance</a> | <a href="#">Popularity</a> | <a href="#">Name</a> | <a href="#">Date</a> </div> </div> <div class="refine-search"> Too many results? <button class="refine" onclick="refineToggle();">Refine your search</button> </div> <div class="refine-options" id="refine-options"> <div class="refine-container"> <h2>Filter results:</h2> <?php echo do_shortcode('[searchandfilter id="44"]'); ?> <script> $('input[type="checkbox"]').after('<span></span>'); </script> </div> </div> <div class="sort-results smartphone"> Sort results by: <div class="sort-links"> <a href="#">Relevance</a> | <a href="#">Popularity</a> | <a href="#">Name</a> | <a href="#">Date</a> </div> </div> <div class="result-list"> <?php while ( have_posts() ) : the_post(); ?> <?php $related_video_url = get_field('wistia_url'); $related_video_id = end((explode('/', $related_video_url))); ?> <div class="result-item"> <div class="video-thumb"> <span class="likes"> <?php $post_like_count = get_post_meta( $post->ID, "_post_like_count", true ); // post like count if($post_like_count != '0'){ echo $post_like_count; } ?> <svg x="0px" y="0px" viewBox="0 0 15 14.4" enable-background="new 0 0 15 14.4" xml:space="preserve"> <path id="favorite-3-icon_4_" fill="#ffffff" d="M7.5,14.4C2,9,0.4,7,0.1,5c-0.4-2.5,1.4-5,4.3-5c1.2,0,2.4,0.5,3.1,1.3 C8.3,0.5,9.4,0,10.6,0c2.9,0,4.7,2.5,4.3,5C14.6,7,13.2,8.9,7.5,14.4z M4.4,1.5C3.2,1.5,2.2,2,1.8,3c-1.2,2.5,1.5,5.1,5.7,9.3 c4.2-4.2,7-6.8,5.7-9.3c-0.5-1-1.5-1.6-2.6-1.6c-1.9,0-2.7,1.5-3.1,2.2C7.1,3,6.4,1.5,4.4,1.5z"/> </svg> </span> <div class="image-thumb" id="wistia_thumbnail_<? echo $related_video_id ?>"> <div class="tag-overlay"> <strong>Tags:</strong><br> <?php echo get_the_tag_list('',', ',''); ?> </div> <a class="thumb-play-overlay" href="<?php the_permalink(); ?>"></a> </div> <div class="video-thumb-title"> <?php the_title(); ?> </div> <script> getVideoThumbnail ('<?php echo $related_video_id ?>'); </script> </div> <div class="video-description"> <h4>Description:</h4> <?php the_title(); ?> </div> </div> <?php endwhile; else : ?> <p><?php _e( 'Sorry, no pages matched your criteria.' ); ?></p> <?php endif; ?> </div> </div> </section> <?php get_footer(); ?>
and my settings are like this: (screenshot)
Any ideas?
Ross Moderator(Private) November 27, 2014 at 1:48 am #8291Hey Jan
Lets try to get this working without Ajax first – so go ahead and disable that.
Once we get it working without we’ll re-enable it.
Once its disabled let me know and I’ll take a look at what is going on.
Thanks
Ross Moderator(Private) November 28, 2014 at 6:58 pm #8378Hi Jan
Can you first, duplicate
search.php
, and rename it? So we can make customisations specifically for the plugin?Then, in the settings tick “use custom templates for results”
and then enter the new filename for the template (ie “newsearchtemplate.php”)?
Without specifying a template the we cannot control which template displays the results.
Thanks
Ross Moderator(Private) December 2, 2014 at 2:12 am #8436Hey Jan
Will check this out tomorrow now, just finishing off a plugin update,.
Thanks
Anonymous(Private) December 3, 2014 at 10:18 am #8497Hi again,
So, I’ve bee staring at this some more. And here’s what I’ve figured out (I think..)
In my “search and filter” setup I’ve added a search field, to make sure that the search-refinement function includes the original search-phrase (this field is css-hidden).
But when i tick off the categories or tags – that’s what’s not included in the filtering when i press Submit, it just repeats the initial search, without the tag/category filtering..Hoping to get this fixed soon 🙂
Ross Moderator(Private) December 3, 2014 at 12:52 pm #8503Hey Jan
Any chance you can send me some temp admin details so I can have a look around?
Thanks
-
AuthorPosts