Forums › Forums › Search & Filter Pro › Variable is not returned in title with the pro version
- This topic has 14 replies, 2 voices, and was last updated 5 years, 5 months ago by
Trevor.
-
Trevor(Private) July 7, 2020 at 11:57 am #251679
You will need to replace 1234 with your form ID.
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(1234)->current_query(); $search_term = $sf_current_query->get_search_term(); ?> <header class="searсh-header"> <h1 class="page-title">Résultats de la recherche : <span><?php echo $search_term;?></span></h1></header>See if that works?
Trevor(Private) July 7, 2020 at 12:18 pm #251704Ah, sorry, I just realized, you want the category to show, NOT the search term?
That may be a little more complex. This MIGHT work:
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(1234)->current_query(); $search_cat = $sf_current_query->get_field_string("_sft_category"); ?> <header class="searсh-header"> <h1 class="page-title">Résultats de la recherche : <span><?php echo $search_cat;?></span></h1></header>Trevor(Private) July 7, 2020 at 12:30 pm #251712More complex is needed then.
<?php global $searchandfilter; $sf_current_query = $searchandfilter->get(1234)->current_query()->get_array(); $search_cat = $sf_current_query['_sft_category']['active_terms'][0]['name']; ?> <header class="searсh-header"> <h1 class="page-title">Résultats de la recherche : <span><?php echo $search_cat;?></span></h1></header> -
AuthorPosts