To keep the theme styling, I think you would need to use either the As an Archive
or the Post Type Archive
display results methods, or you would need to customize the code in the results.php template used by the As a Shortcode
method you are using, as outlined here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
AnonymousInactive
We know how to customize the results, for example via the results.php file.
But I don’t know how or where I can customize the filter itself.
I need to add some JavaScript code because I want to hide and display my big amount of categories via checkboxes and reduce this long list of categories with a “Show more/Show less” button.
To do so, I need to edit the HTML of the filter I use and adding some JS code for my button.
Could you help me to do that or find where is located this file please?
PS: Sorry if the question has already been asked in this forum, but it is not easy to find an answer in all the asked questions here, even via the search field.
Thank you.
Are you able to send me a live link/URL to your search page so I can take a look?
In general, instead of using the content and structure of the HTML to be found in the exemplar results.php file, you would use that inside the exemplar results-infinite-scroll.php file, but the template file that your form is using, should still be named results.php, or be numbered the same as the form ID, all as detailed here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
DO use a child theme when you do this.
AnonymousInactive
So I’ve used original results.php, and as I’ve understood if the “resuls per page” placed less than there is original results, then after user hit on reset button, it will only show “display results” that was given in filter (for example 6) but not 15.
AnonymousInactive
Hi Trevor,
So what I did, I’ve made custom <a href="">
link so it’s separated from filter. And also what I’ve found out that if I change results per page from 10 to 50, then it will show only 50 results after for example you hit that reset button link. When I use backup results.php then I can’t get back the infinite scroll basically. So I’m using my modified results.php and then just apply custom a href link and place 50 results per page.
Ah, you need to remove our code. As you are using our Shortcode display results method, then the default template is the results.php
file found in the plugin folder templates sub folder. YOU SHOULD NOT edit that file, as it WILL be replaced upon updates. Instead, follow the customising guide here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
This is the code you need to remove:
<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
It appears twice in the template, once at the top, once at the bottom. Just those two lines.
AnonymousInactive
Hi,
I’ve instaled WP-Page Navi and looks great but… 🙂
When I activate this plugin, I see the old pagination and a new one.
https://prnt.sc/rjagn4
Maybe I have to delete something from results.php?
What files are you referring to?
Normally, one should work with a child theme. If you are not, then make one using the Orbisius plugin that will do it for you. Simply accept the default settings and it will make and activate it for you, then you can remove that plugin.
Modified files should always be kept in the child theme folder. For example, if you modify our results.php file, make a sub-folder in that child theme folder named search-filter
and place the modified file in there.
You seem to have customised the results.php file, but it must have errors as it also shows ‘no results found’?
This post might help you with code for what you want:
https://support.searchandfilter.com/forums/topic/category-description-in-search-results/page/2/#post-236248
That code is for _sft_category and the id number is wrong, so maybe this?
global $searchandfilter;
$sf_current_query = $searchandfilter->get(3637)->current_query();
$sf_current_query_array = $searchandfilter->get(3637)->current_query()->get_array();
if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
echo '<div>No category selected.</div>';
} else {
echo '<div>' . $sf_current_query_array["_sft_menucats"]["active_terms"][0]["value"] . '</div>';
echo '<div>' . $sf_current_query_array["_sft_menucats"]["active_terms"][0]["id"]. '</div>';
echo '<div>' . category_description($sf_current_query_array["_sft_menucats"]["active_terms"][0]["id"]). '</div>';
}
Otherwise, are you able to send me temporary WordPress admin logins (ones you should later delete or disable) for the site so that I can look at the setup? Please use a Private Reply.
As it works in this manner, albeit badly because of edits you have made, that means that the issue lies with the customized results.php template file, and , in turn, specifically with the code you have used. In that file, you are calling a theme function to output the posts. My guess is that this is where the problem lies. Now, it is curious that it cuts off at 10 posts, which is a very common default theme ‘posts per page’ setting.
I did look at the Reading settings for your install of WordPress, and this is actually set at 6 posts per page on the blog, so the setting must be elsewhere. It will either be one that you can set somewhere in the theme options, OR hard coded into the theme files.
So, that is the first thing you need to investigate.