Forums › Forums › Search & Filter Pro › Filter Query Args
- This topic has 23 replies, 2 voices, and was last updated 8 years, 9 months ago by Ross.
-
Ross Moderator(Private) February 18, 2016 at 11:01 am #37301
Hey Christopher
I think the issue here is, get_queried_object I believe will retrieve the last queried object.
So depends where you are calling
get_queried_object
, maybe you should call it somewhere much earlier in the code, save the variable, then use this variable in S&F.Anyway, on to the next issue.
For me it looks like it still works with pagination?
What happens when you stop using
get_queried_object
and manually set it – like:hotels-motels
as per your earlier example, does the filtering work across pagination & when using hte filters?I’m guessing it will.
In this case, then we are back at the issue of how
get_queried_object
is working.Thanks
Anonymous(Private) February 18, 2016 at 5:41 pm #37355Hi Ross,
it appears that you are correct aboutget_queried_object
being the issue.Yes pagination still works.
When I enter hotels-motels as a static value everything appears to work properly.
How do you go about saving
get_queried_object
from a template and using it in the filter function for S&F? Is there a way of filtering the query_args from within the template (or would that even help?)?Ross Moderator(Private) February 24, 2016 at 8:56 am #37795Hey Christopher
Getting the right info at the right time with
get_queried_object
is really not a S&F issue, but more a general WP issue.That being said, I do want to test this theory out so will be setting up a demo locally in the next few days and let you know the result.
My idea is to capture the get_queried_object value say on the WP init hook, and store it in a global variable – where exactly to do this is the purpose of my testing – I don’t know the correct time to detect the current archive.
Then later on in the execution, lets say before a S&F query (any kind) we can call up this variable rather than using the function
get_queried_object
to modify S&F behaviourThanks
Anonymous(Private) March 8, 2016 at 9:48 pm #39021Kind of interesting discover on this today. Using http://selkirkloop.org/wordpress/member-category/lodging/hotels-motels/ as an example. once I’ve made a selection from my dropdown (we’ll use British Columbia) and submit, the search clears the results and displays all members (nothing new), but when I select “next” in the pagination, it remembers my search criteria and reapplies hotels and motels to it.
I also tried using
single_cat_title("", false);
as an alternative toget_queried_object
, but that made no difference.Ross Moderator(Private) March 9, 2016 at 1:37 am #39032Hey there
Ok so I stumbled across what it may be.
Can you disable Ajax and test again?
Also, can you just confirm your display method is current “shortcode”?
Thanks
Anonymous(Private) March 9, 2016 at 4:47 pm #39071Hi Ross,
my display method is “shortcode” . My results shortcode is added in the template like this<?php echo do_shortcode( '[searchandfilter id="3906" show="results"]' ); ?>
I have turned off displaying results with Ajax and I now receive no my standard search.php page with no results found.
With Ajax on and “Update the Search Form on user interaction” turned off, the search works with the category criteria as long as a term is entered in the search field. If a category is selected without a term in the search field, it shows everything in that category without filtering via the “Hotels & Motels” .
Let me know if I need to clarify any of this.
Thanks.
Ross Moderator(Private) March 9, 2016 at 6:50 pm #39073Hi again Christopher
I see, please take a look at your Results URL setting in the display results tab – it should be:
http://selkirkloop.org/wordpress/member-category/lodging/hotels-motels/
Which is why you get a 404:
http://selkirkloop.org/wordpress/member-category/lodging/hotels-motels/_sft_member-region=washington
There is no
?
in the URL (which will be fixed with a valid results URL – and will become:Thanks
-
AuthorPosts