Looking for support? You can access the support system via your account.
- This topic has 5 replies, 2 voices, and was last updated 3 years, 2 months ago by .
You must be logged in to reply to this topic.
Looking for support? You can access the support system via your account.
Forums › Forums › Search & Filter Pro › First session without results, how to do it?
Hello,
I need to activate a “Ajax” search form in the home page but without results when a user open it the first time.
I’m using “Beaver Builder Posts Module” to see the results but I don’t have problem to change it with the “shortcode” modality, but before I’d like to know how start the session without results on the page.
Thanks.
Using the Shortcode method, you would need to edit the results.php file, as detailed in this post:
You would need to follow our guide when doing that:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
Hello Trevor,
can you please confirm the following?
1) I’ve created a custom results page with the ID (14) of the search form…
wp-content\themes\my-child-theme-name\search-filter\14.php
2) … I’ve put all the current php code, except:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
3) … in the section commented “// the current results.php code here”
global $searchandfilter;
$sf_current_query = $searchandfilter->get(14)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
echo '<div>Nothing to see here folks!</div>';
} else {
if ( $query->have_posts() )
{
?>
...
Is the above procedure correct?
If I need to translate the website (using WPML), do I need to create a new search form and a new custom results page (so with another ID)?
Thanks.
Another question… is it possible to have in the dropdown menu, the voice “All” that selecting it load all the results?
Is not important (I can change the name from “All” to “Select”), but this option would give the search a full function.
Thanks.
Another “little” request… I’ve inserted this code in the page to show the taxonomies but I don’t know how to customise it (e.g. change the separator “,” and remove the “and” for the last value when the list is multiple and the dot at the end “.”, remove/change the taxonomy title before of the values):
<p><?php the_taxonomies(); ?></p>
How can I do it?
The code looks OK. When you translate a form it gets a different ID, so you can do the same but with a different filename instead of 14.php for example.
I have not seen an easy way to change the All label, you might need to use JavaScript to do this.
As for that function, I can only refer you to the WordPress Codex for options:
https://developer.wordpress.org/reference/functions/the_taxonomies/
You must be logged in to reply to this topic.
© 2024 Search & Filter Support. All Rights Reserved.
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 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.
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!
More information about our Cookie Policy