-
AuthorSearch Results
-
June 5, 2019 at 9:27 am #213328
In reply to: i want to get the current active filter sort label
TrevorParticipantYou can find more details from the filter query array.
You may need to temporarily output the array to see how to access the term that you want.
If you add this code to the page, it will output the entire array:
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(1391)->current_query()->get_array(); echo '<pre>',print_r($sf_current_query,true),'</pre>'; ?>
May 29, 2019 at 10:12 am #212706
TrevorParticipantIf I understand you correctly, you need to output the currently searched for term(s) on the results page. To an extent, this is limited by how the page is constructed, but as long as you have a PHP template and know how to edit/code that, you should be able to achieve what you want.
To show the filters, as I said, this requires custom coding when using the current version of Search & Filter Pro. You can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
May 10, 2019 at 11:42 am #210744In reply to: can i get value in result url $get['key']
TrevorParticipantTo showing the filters, this requires custom coding when using the current version of Search & Filter Pro. You can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
April 25, 2019 at 4:01 pm #209333In reply to: How to display filtered results count and filters?
TrevorParticipantI am sorry for the delay. I am working my way through a backlog and I answer posts is oldest last touched order, so yours was still another two or three down the list when you sent that last reply. The standard WordPress would, with your wp_query() array name, look like this:
Found <?php echo $query_all->found_posts; ?> Results
As to showing the filters, this is more complex. It would require custom coding when using the current version of Search & Filter Pro. You can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
April 25, 2019 at 2:07 pm #209306In reply to: Display selected filters
TrevorParticipantIt would require custom coding when using the current version of Search & Filter Pro. You can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
April 16, 2019 at 9:40 am #208462In reply to: Post Meta display current filter
TrevorParticipantYou can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
March 29, 2019 at 4:56 pm #206924In reply to: Hook to display number of filtered results?
TrevorParticipantThere is not, sorry. You can access the filter terms though, but would need further PHP work to display them. To fetch the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lots of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note, if you are using Ajax refreshing of the results, any PHP needs to be inside the Ajax Container, or it will not update.
February 3, 2019 at 11:12 am #201022In reply to: How to display Taxonomy in Search Results.php?
TrevorParticipantHi
There is a code back tick on most keyboards; use that once before and once after the code you post. On my keyboard it is the key to the left of the 1 key.
As to fetching the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lost of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
January 17, 2019 at 1:47 pm #199219
TrevorParticipantYou are not using our integration guide for Elementor?
https://searchandfilter.com/documentation/3rd-party/elementor/
The https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lost of other data. If you have other filters, then it becomes a little more complex, but I can give you links. 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/
Note that (as far as I know) you cannot run PHP in Elementor elements. It has to be inside a PHP template, or inside a shortcode that can run PHP (there are such plugins out there that let you make shortocdes that use PHP).
January 8, 2019 at 2:37 pm #198357In reply to: Cannot filter on custom wp post
AnonymousInactiveWell I might have asked wrong way 🙂
The thing is the filter as I call it with the shortcode shows up, but if I try to filter results (e.g. I select one region in the dropdown or white a text to the search input and press submit), nothing changes – the result set of $trainers remains unchanged (unfiltered), so as the $GLOBALS[‘wp_query’]->request).
From your first link you provided, I tried this code:
$sf_current_query = $searchandfilter->get(1513)->current_query(); echo '<pre>'; print_r($sf_current_query->get_array()); echo '</pre>';
and got
array (size=10) 'paged' => int 1 'search_filter_id' => int 1513 'search_filter_override' => boolean false 'posts_per_page' => int 10 'post_status' => array (size=1) 0 => string 'publish' (length=7) 'meta_query' => array (size=0) empty 'post_type' => string 'trainer' (length=7) 'is_search' => boolean true 'is_archive' => boolean true 'post__in' => array (size=7) 0 => int 1284 1 => int 1495 2 => int 1503 3 => int 1504 4 => int 1505 5 => int 1506 6 => int 1508
(notice there is no sign of filtering in the array). This is my main problem.
-
AuthorSearch Results