If you are using the Shortcode results method, and our results.php template file, it would look like this:
global $searchandfilter;
$sf_current_query = $searchandfilter->get(1024)->current_query();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
echo '<div>Nothing to see here folks!</div>';
} else {
// your template archive code/loop OR results.php code here
}
Change 1024 to the ID number of your form (from the form shortcode).
I will take the second question last. You would need to add a second plugin to search as you want. The simplest one that I think will work is WP Extended Search, and you can set that up to search in whatever you want. If that does not work, then install the free Relevanssi plugin and set it up, see our documentation here:
https://searchandfilter.com/documentation/3rd-party/relevanssi/
For editing the results.php file, see here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
AnonymousInactive
Yes, it’s the results I need to fix. I have not edited the results.php file, what you saw is what is shown without any edits. But I think I will edit the results.php, because that looks like what I wanted.
However, I have another question: I have set the search box to search pages that I have assigned to a category (another plugin lets me do that), but when I search, I don’t always get results even though I think there should be something there. Does it search for the title of the page or does it search for the name of the category or does it search both? For example: the page title is “Brooklyn” and the category assigned is “New York”, should I see something when searching for New York? Because I don’t.
Basically what I want is to be able to search both page title and category. And when the search results are from hits on a category, I want all the pages assigned to that category to show up.
Thanks again,
Axel
Ah. I had thought (misunderstood) that you meant to alter the form, but it is the results in question.
Does you theme have normal (unfiltered) page that looks like this? Let me know what the theme is and maybe give me a link to a page like the one you want.
If so, as I see you have already edited the results.php file, you could further add the extra HTML to make that structure.
You are using the Shortcode method. Did you modify the results.php, and what is wrong with the appearance of the results? I notice that the column widths change. Is that the issue?
AnonymousInactive
Could you tell me where to insert this in results.php, so that it will still work?
Thanks!
Yes, I am using the shortcode display method.
AnonymousInactive
Hi, I would like to output the formats I have defined in Events Manager for the event dates, times and teaser text to the Search & Filter Pro results page. Using the_excerpt() function strips away the formatting.
I’ve asked Events Manager Support and they said to use this code to get the EM formats:
$post = get_the_post(); //or however you do it
$EM_Event = em_get_event($post);
echo $EM_Event->output(‘output your html with placeholders’);
However, I could not integrate this into your results.php page without throwing an error, or disabling the live search functionality.
Do you have any suggestions? I’ve tried the_content() but that outputs my entire events detail page, which I don’t want on the search page.
Many thanks in advance.
The shortcode method and customising it is explained here.
Once you have your own copy of the results.php template file, it needs to be edited so that it makes results similar to your theme. It depends how complex your desired outcome is as to how hard it would be re-create.
If you have a page builder plugin in your site, it may also be that we have an integration for that.
It must be the way you are doing the pagination. The standard WP pagination is how we set up our Shortcode method example results.php (see inside our templates folder).
AnonymousInactive
Since I have to use Geodirectory’s templating to get the specific layouts to work (social, web/email), I have not tried. (Using the standard results.php only loads the basic text).
But, this only happened after I added the email field. When the Email field is disabled, the Ajax loading works. (I have it disabled right now).
I have already run a log file, and cannot trigger any errors.
This is the closest clue I have, which may put this in Geo’s territory,
https://stackoverflow.com/questions/2360076/javascript-document-write-replaces-all-body-content-when-using-ajax
“You can’t use document.write once the document has completed loading. If you do, the browser will open a new document that replaces the current.”
I suspect Geo will not support this issue, since they have their own search tool they sell as part of their program. And it is AWFUL (this tool rules, by far)…
This is a major project, as you may imagine (THE Great Smokies..). So, hopefully we can find a solution.
Thank you