Forums › Forums › Search & Filter Pro › results display
Tagged: display, remove posts meta
- This topic has 7 replies, 2 voices, and was last updated 5 years, 9 months ago by Trevor.
-
Anonymous(Private) February 13, 2019 at 11:44 am #202104
Hello how do I prevent results showing before the submit or search is clicked?
On the site i am working on, for instance, I would prefer the search form to show on its own, without the different posts, before the search query is submitted – mtai.ie
(Same problem on this page find a teacher)
Also, how do I prevent the date of the posts showing in the results?
Thank you.Trevor(Private) February 13, 2019 at 2:53 pm #202121If you are using our Shortcode Display Results method, then the results.php needs to be modified like this (where the ID number will need to be changed to match your form ID):
global $searchandfilter; $sf_current_query = $searchandfilter->get(36613)->current_query(); if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) { echo '<div>Nothing to see here folks!</div>'; } else { // your current results.php code here }
If using other methods, and if you have access to the template PHP files, you could use similar code.
Make sure any files you modify are in the child theme folder (if you copy our results.php file, it needs to be in a sub-folder of the child theme, called
search-filter
, not our plugin folder or a parent theme folder).Anonymous(Private) February 13, 2019 at 3:24 pm #202123OK, so are we talking about the results.php file in the Templates folder, in the search-filter-pro folder?
Do I call the new sub-folder search-filter or search-filter-pro?
Is the ID number to replace you refer to in the above example the number here – get(36613)?
Do I paste the entire results.php after the comment out line //?
i.e. replace “your current results.php code here” with the complete results.php code?Also, how do I prevent the date of the post showing in the results?
As far as I can see, I’ve turned off meta.Trevor(Private) February 13, 2019 at 3:41 pm #202128You appear to be using our Shortcode Display Results method. The guide to customising it is here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
As you have two different forms, you will need two results templates, once named:
447.php
and another named:
571.php
The documentation tells you to name the folder
search-filter
The ID in my example 36613 needs replacing with 447 and 571, depending on the file it is in.
You remove that whole comment line, and replace it with the code for the results template for the relevant search form and results page.
Your results template for that page must still have this in it:
<p><small><?php the_date(); ?></small></p>
It needs to be removed.
Anonymous(Private) February 18, 2019 at 10:42 am #202545Hello, I’ve tried what you suggested on this page https://mtai.ie/how-to-find-a-course/ The search box displays on its own, which is what I want, but it is now not returning any results. Have I left something out, or gotten something wrong? I’ve tried turning off auto auto-submit. Also, when I try to refresh that page after doing a search, I get the “Confirm form resubmission” warning. I am using the shortcode method, and Elementor Pro for the templates.
What I want to achieve is to display the search box, on its own, then the user clicks submit, and the results display.
If it is not possible, how can I style the results so that they are more compact?
Another issue I notice is that it is necessary to click the submit button more than once to get the form to submit. -
AuthorPosts