-
AuthorSearch Results
-
January 8, 2019 at 2:27 pm #198353
In reply to: Cannot filter on custom wp post
TrevorParticipantAh, I see. I misunderstood your initial question. I am sorry for that. At least, I think I understand.
Showing the word searched for is not so difficult. If you have other filters, then it becomes a little more complex, but I can give you links. The documentation page:
https://searchandfilter.com/documentation/accessing-search-data/
This thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
December 11, 2018 at 3:23 pm #195909In reply to: Results initially added via AJAX
TrevorParticipantThis thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
October 31, 2018 at 5:53 pm #192423In reply to: Checkboxen uncheck after ajax refresh
TrevorParticipantThis thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
October 16, 2018 at 11:58 am #191063In reply to: Echo the query/search term
TrevorParticipantShowing the word searched for is not so difficult. If you have other filters, then it becomes a little more complex, but I can give you links. The documentation page:
https://searchandfilter.com/documentation/accessing-search-data/
This thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
October 10, 2018 at 4:00 pm #190680In reply to: Current filters and reset buttons
TrevorParticipantShowing them is one thing, and quite complex, but I can give you links. Adding x’s to remove them is far more difficult. You would, in either case, have to do the coding yourself, as such custom coding is outside of our normal support. I think this feature is coming in V3, which is in development.
This thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
August 29, 2018 at 2:31 pm #186695In reply to: Accessing the Search Data
TrevorParticipantThis thread might help you:
https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/
… and this search will give similar threads I think:
https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/
June 25, 2018 at 12:31 pm #181171In reply to: Sort order – different query
TrevorParticipantYou could use PHP to look at the array that holds the filter arguments, and conditionally load different code in the same template. Again, that is custom coding.
To start with, put this code on the results page in a suitable place:
$sf_current_query_array = $searchandfilter->get(1446)->current_query()->get_array(); echo '<pre>'; print_r($sf_current_query_array); echo '</pre>';
CHANGE THE ID NUMBER in the above code (1446) to whatever the ID of you form is.
You will then see the array of filters used, and you can figure than how to fetch the value you need to add PHP to your template to test what the user has selected.
May 17, 2018 at 7:25 am #178123In reply to: Get Count of Filters
TrevorParticipantPlease note that, as your license has expired, you will first need to renew at the (discounted) renewal price to receive support.
Does this code show anything different?
$sf_current_query_array = $searchandfilter->get(1446)->current_query()->get_array(); echo '<pre>'; print_r($sf_current_query_array); echo '</pre>';
You will need to change the ID number of course. There are some threads on the forum that you can search for where other users have used this code to access the filters data.
April 23, 2018 at 7:08 am #173724In reply to: Select Box Like Ted
TrevorParticipantAssuming that
Post Type
is one of the search fields, it should work in exactly the same way. If it does not, you need to print out the entire search/filter array and examine the structure, like this:$sf_current_query_array = $searchandfilter->get(1446)->current_query()->get_array(); echo '<pre>'; print_r($sf_current_query_array); echo '</pre>';
Change the ID accordingly for your form.
And then check to see if the terms you need are contained in that.
April 12, 2018 at 11:07 pm #171986In reply to: Display multiple terms
AnonymousInactiveTrevor, thanks again for spending time with me today. I really appreciated it.
Good news, I finally figured it out!
Here’s the happy code:
<?php global $searchandfilter; $args = array( "str" => '%2$s', "delim" => array(", ", " - "), "field_delim" => ', ', "show_all_if_empty" => false ); $sf_current_query = $searchandfilter->get(99801)->current_query()->get_array(); $sf_current_style_query = $searchandfilter->get(99801)->current_query()->get_fields_html(array("_sft_style", "_sft_name"),$args); $sf_current_cuisine_query = $searchandfilter->get(99801)->current_query()->get_fields_html(array("_sft_cuisine", "_sft_name"),$args); echo '<strong>Filters</strong>'; if ( empty($sf_current_query ) ) { echo ' • ' . "All" . "<br /><br />"; } else { echo ' • ' . $sf_current_query['_sft_category']['active_terms'][0]['name'] . ' • ' . $sf_current_query['_sfm_wpcf-location-city']['active_terms'][0]['name'] . ' • ' . $sf_current_style_query . ' • ' . $sf_current_cuisine_query; echo "<br /><br />"; } ?>
Cheers!
-
AuthorSearch Results