S&F doesn’t search tag names, nor does the default WP search – try your “Flowers” test with the old search and you will see (you can search tag names by combining S&F with Relevanssi).
RE the input box, thats the last step we missed!
So, each of the search input fields, that you have changed to be renamed to _sf_s, also has a value attribute.
we need to get the S&F search term into this value attribute. I can see in both your header and search templates, that the query is populated with the value from this line:
<?php $searchresults = get_search_query(); ?>
So all we need to do is get S&F search query into that variable – from the docs you would replace the code above with –
<?php
//Get the search term
//replace <code>4243</code> with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(4243)->current_query();
$searchresults = $sf_current_query->get_search_term();
?>
Hi!
Sorry for my late reply but I had to complete another project..
If I do a var_dump I get the following:
array(2) { [“authors”]=> array(5) { [“name”]=> string(7) “Authors” [“singular_name”]=> string(6) “Author” [“all_items_label”]=> string(11) “All Authors” [“type”]=> string(9) “post_type” [“active_terms”]=> array(1) { [0]=> array(3) { [“id”]=> int(39) [“name”]=> string(7) “Agenzie” [“value”]=> string(7) “agenzie” } } } [“_sf_post_date”]=> array(1) { [“active_terms”]=> array(2) { [0]=> array(1) { [“value”]=> string(8) “01032016” } [1]=> array(1) { [“value”]=> string(8) “16032016” } } } }
In my form I have Authors (in this example value for that is “Agenzie”) and Post Date range fields.
I am not expert in PHP…can you help me to get the authors and post date range?
As $sf_current_query->get_field_string(“authors”) does not work.
Hi, How would I display the sort order in a way similar to displaying categories or tags? Here’s the code I’m using, but only _sft_category and _sft_school display on my page.
<?php
//Get a single fields values using labels
//replace 1526 with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(147)->current_query();
var_dump($sf_current_query->get_array());
?>
I just put in page template:
<?php
//Get a single fields values using labels
//replace 1526 with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(147)->current_query();
echo $sf_current_query->get_field_string(“_sfm_xxx”);
<?php
//Get a single fields values using labels
//replace 1526 with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(147)->current_query();
echo $sf_current_query->get_field_string(“_sfm_xxx”);
<?php
//Get the search term
//replace '1526' with the ID of your search form
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1526)->current_query();
echo $sf_current_query->get_search_term();
?>
2) Which display method are you using? If you are using archive then it sounds like you have set your template up wrong (a little). This really depends on your theme, so go into your theme and take a look at other template files such as archive.php or search.php.
Usually you should at least be starting with a get_header() and finishing with a get_footer() – but this is really theme dependent – https://codex.wordpress.org/Include_Tags
Thanks
Author
Search Results
Viewing 10 results - 351 through 360 (of 374 total)
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
We also use cookies to store items in your cart as well as allowing your to login on the site.
You can adjust all of your cookie settings by navigating the tabs on the left hand side.
By continuing to use this site, you also agree to our Privacy Policy.
Strictly Necessary Cookies
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
*Other cookies used for logging in and cart functions will only be used when you use those features and cannot be disabled.
If you disable these cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
3rd Party Cookies
This website uses Google Analytics to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
Please enable Strictly Necessary Cookies first so that we can save your preferences!