AnonymousInactive
OK – used a static title. Re the number of results I’ve copied the code from results.php but it doesn’t return the number:
<?php if ( have_posts() ) : ?>
<header class=”page-header”>
<h1 class=”page-title”>My Title</h1>’
</header><!– .page-header –>
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?>
And for the search term I meant “is possible to show the numbers next to the filters (on the search form)?” rather than on the results page.
You don’t need a function in there at all.
You can simply put this:
<header class="page-header">
<h1 class="page-title">Search Results</h1>
</header><!-- .page-header -->
As for placing the search terms, that is a little harder. It would have to be done by your theme, or in that template. You can look at how we do it (for the Shortcode method) in the file results.php found in the plugin’s template folder, and also see this documentation:
https://searchandfilter.com/documentation/accessing-search-data/
Note that when the results update using Ajax, the search terms can only update if the method that you use to show these is inside the code that makes the id=”main” section of the page.
OK. The Title we can fix I think. After that is done, then I will explain the page thing. Using ftp, can you copy from your child theme folder the file archive.php to make a new file called search-results.php in that same folder?
AnonymousInactive
Dear agent,
I’m using the filter to display books. I already fiddled with the results.php to get my own custom results. Now, I need to display the books from new to old. I’ve created a new ACF number field to enter the release year of the book.
In the option ‘Posts’ of Search and Filter, I select ‘Meta Value’ under ‘Default order’ and select the ACF field Ive created and use Numerical. But it’s not showing it from new to old (or old to new)(I don’t know what order its using).
I tried to change the ACF-field to a text-field and use the alphabetical order, but that’s not working either.
I don’t know what I’m doing wrong and hope you can help me out.
Kind regards,
You would need to be using our Shortcode Display results method, and have followed the guide to customising:
https://support.searchandfilter.com/documentation/search-filter-pro/search-results/using-a-shortcode/
Once you have a copy of the results.php file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):
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 {
// the results.php PHP code here
}
Make sure you change the ID number in that snippet to the ID number of your form.
Hi
So, we sorted this by using code in the results.php file to stop the results showing at all. The developer at your end has written javascript to re-submit the form with a date filer, and at tha point the results then show. Not an ideal solution to do it that way, but it works. I will close this thread for now.
Which Display Results method are you using? If it is the Shortcode method, you should follow this customising guide:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
You will have a copy of the results.php ile in your theme folder (in a sub-folder called search-filter). In that, you can edit the message.
The spinner isn’t a standard feature but can be done using javascript, which we can look at once I get the No Results Found part sorted.
If you followed this customising guide:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
You will have a copy of the results.php ile in your theme folder (in a sub-folder called search-filter).
Edit that file and find the image part (usually on line 59) and change the word small to thumb.
You are using our Shortcode Display Results method and so will have coded the results.php template. In that, it use the WordPress function the_date(). One effect of this function is that it does not repeat the same date, it shows it only for the first post with that date.
If instead you use echo get_the_date() that will always output the date.
AnonymousInactive
I just copied the new version of the code in the results.php