Forums › Forums › Search & Filter Pro › Search results for ""
- This topic has 5 replies, 2 voices, and was last updated 6 years, 5 months ago by Anonymous.
-
Anonymous(Private) May 21, 2018 at 10:51 am #178683
Hi,
The plugin works is working on my site and with my theme (Soledad). However, on the search return results page it does not include the search term in the title so the page is titled:
Search results for “”
with the content below – see screenshot here: https://www.dropbox.com/s/udy8v54eyvmm9zd/Screenshot%202018-05-21%2010.50.19.png?dl=0
Is there any way to get the search term showing in the search return page so that the title looks right?
Thanks,
Matthew
Trevor(Private) May 21, 2018 at 1:17 pm #178718Accessing and using the Search Data can be complex of your form is complex, however, this documentation page will start you off:
https://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/
Anonymous(Private) June 8, 2018 at 2:20 pm #180060Hi Trevor,
Thanks for your help with this. It looks like the code I need to use is:
Get the Search Term
<?php
//Get the search term
//replace1526
with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
echo $sf_current_query->get_search_term();
?>However, I’m not clear where I should be inserting this in the theme – should I be looking for the search.php template file and inserting it in there where the searched terms are shown?
Thanks,
Matthew
Anonymous(Private) June 8, 2018 at 2:27 pm #180062If it helps, this is the title bar for my search return page:
<div class=”title-bar”>
<span><?php echo penci_get_setting( ‘penci_trans_search_results_for’ ); ?></span>
<h1><?php printf( esc_html__( ‘”%s”‘, ‘soledad’ ), get_search_query() ); ?></h1>
</div> -
AuthorPosts