Forums › Forums › Search & Filter Pro › How to display Taxonomy in Search Results.php?
Tagged: results, Taxonomies
- This topic has 3 replies, 2 voices, and was last updated 5 years, 8 months ago by Anonymous.
-
Anonymous(Private) February 1, 2019 at 5:20 pm #200984
Hi! Still loving this plugin. It quickly became a favorite. Quick question: I have results.php with the following else:
`
else
{
?>
<div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
<h3>We couldn’t find anyone with “<?php
global $searchandfilter;
$sf_current_query = $searchandfilter->get(4716)->current_query();
echo $sf_current_query->get_search_term();
?>”.</h3>
</div>
<?php
}
`
My problem though is that when I sort by a taxonomy, eg
orgs
ordivisions
with a drop down cromobox without a search term the""
. is left blank. What do I need to add to the above to return the taxonomy/taxonomies?Thanks!
Trevor(Private) February 3, 2019 at 11:12 am #201022Hi
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/
-
AuthorPosts