-
Search Results
-
On NovaScotiaFood.com I have a search form that uses AND as an operator. The user simply selects a category of food producer and a county, and they get a list of that type of food producer in the selected county. The search works fine. The results are not yet displaying the way I’d like.
I’ve just copied some of your example code on my results page:
<?php //Get a multiple fields values by passing an array of field names //replace <code>1526</code> with the ID of your search form global $searchandfilter; $sf_current_query = $searchandfilter->get(1949)->current_query(); /* * EXAMPLE 1 */ echo $sf_current_query->get_fields_html( array("_sft_category", "_sft_meta_value") );where I just tried to guess that ‘_sft_meta_value’ would output the custom field entry that was searched for, but I guessed wrong. What should I be putting in there instead to correctly output the custom field? Thanks.
Hi, I am using your (terrific) plugin with Elementor Pro. I am having quite a hard time displaying a headline with the chosen custom categories above my search results. I mean: Search results for taxonomy a1, taxonomy a2, taxonomy b and taxonomy c.
I found your post:
https://support.searchandfilter.com/forums/topic/results-displayed-results-count-searched-tag-associated-categories/and adapted it for my use. It turned out quite well BUT this headline does not change when I select another filter. Can you think of any solution for this?
My code:
<?php global $searchandfilter; $sf_query = $searchandfilter->get(5360)->current_query(); if ($sf_query->is_filtered()) { $sf_current_query = $searchandfilter->get(5360)->current_query()->get_array(); echo "<b>Onderzoek met betrekking tot "; $cat_string = ""; foreach($sf_current_query['_sft_category']['active_terms'] as $item) { $cat_string .= $item['name'] . ", "; } $starost_string = ""; foreach($sf_current_query['_sfm_starost']['active_terms'] as $item) { $starost_string .= $item['name'] . ", "; } if (($sf_current_query['_sft_reflex-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_reflex-categorie']['active_terms'][0]['name']) . "</p>"; if (($sf_current_query['_sft_vaardigheden-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_vaardigheden-categorie']['active_terms'][0]['name']) . "</p>"; if (($sf_current_query['_sft_diagnose-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_diagnose-categorie']['active_terms'][0]['name']) . "</p>"; echo "</b>"; } ?>My CSS:
p {
margin: 0;
display: inline;
}p:not(:last-child)::after { content: ” & “; }
p:last-child::after { content: “”; }Thank you so much in advance!
Monique