I think that the issue is that the selectors all have to be in the results.php template, and not loaded in that external code call. The Infinite Scroll works by asking the results.php file to reload the PHP part of the results.php file that is specified. If that classname is not actually in that file, but is instead inside another file called from within the loop, it won’t be found. Thus, it cannot ‘clear’ them. You may have to grab the code from that external code call and bring it directly inside the resuls.php file.
For me it goes:
12
5
5
12
12 and seems to stay with 12 as I continue.
What happens if you revert it to the standard results.php file?
AnonymousInactive
Hi!
I want to prevent the result appeared before clicking the button or selecting any search form field.
I’ve used this https://support.searchandfilter.com/forums/topic/results-display-3/, and it worked.
However, when I try to use Post Grid plugin to customize the display, the result is always shown after page load (same as before using custom results.php).
How to fix that?
Thank you
If you browse through the plugins files, there is a templates folder. Look at the code in the results.php file. The code in that file is based on the basic code structure suggested in the WordPress Codex.
You might also look at the theme files you have and see if there is one named archive.php
If you want only a single page for results, you could use our Shortcode method and modify the code in the results.php template file. Many users do this, there is a guide to customising in our documentation on how to start this.
As you are using our shortcode method the display of the results comes from our results.php file. You would need to customise it as described (in basic form) here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
You need to remove the line:
<p><small><?php the_date(); ?></small></p>
AnonymousInactive
Hello,
I’d like to list particular custom taxonomy links in my shortcode results (the way categories and tags are already listed).
In the results.php file (saved in a child theme), how do I go about that? I’m guessing it’s to do with the_terms(), but I’m struggling to set it up.
<div>
<h2>“><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
<p><?php the_category(); ?></p>
the_terms() ???
<p><small><?php the_date(); ?></small></p>
</div>
For example I have a taxonomy with an ID called ‘content-type’ which I’d like to list.
Any help would be brilliant.
Many thanks
I apologise for the delay, I ran out of time yesterday.
If you haven’t already done so, can you follow this guide:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
In particular, follow the instructions in the Customising section.
That will give you a results.php file you can edit, in a sub-folder named search-filter in your theme folder.
To make the pagination look nicer, install the free WP-PageNavi plugin and delete these lines in the results.php template file:
<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>
To show only a link to the pdf itself, replace these lines:
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<p><small><?php the_date(); ?></small></p>
With this:
<h2><a href="<?php echo esc_url(wp_get_attachment_url(get_the_ID () , false )); ?>"><?php the_title(); ?></a></h2>
If you are using the Shortcode display results method …
If you haven’t already done so, can you follow this guide:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
In particular, follow the instructions in the Customising section.
However, I think you have missed this crucial step, based on your post:
Rather than copy the results.php file to your theme sub-folder, copy the results-infinite-scroll.php file, and then rename it to results.php
The code for this file is different, to account for how the Infinite Scroll works.
That will give you a results.php file you can edit, in a sub-folder named search-filter in your theme folder.
So, look for this code in the results.php template file:
Found <?php echo $query->found_posts; ?> Results<br />
… and delete that line.
Please note that in the UK today is a public holiday, so further replies may be delayed.
I apologise for the delay Jens, I ran out of time yesterday.
If you haven’t already done so, can you follow this guide:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
In particular, follow the instructions in the Customising section.
That will give you a results.php file you can edit, in a sub-folder named search-filter in your theme folder.
Would you want to show that after you search? My guess is yes. So, look for this code in the results.php template file:
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
And change that to (I think this will work):
global $searchandfilter;
$sf_current_query = $searchandfilter->get(30408)->current_query();
if (!((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()==""))) {
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
}
You can change anything else you want also. For example, to make the pagination look nicer, install the free WP-PageNavi plugin and delete these lines:
<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 isn’t, I am sorry. Two possibilities I can think of. One is to change the template so that the change is inside an if condition, and you check to see what page/post you are on? That would be my first choice. The other option is to make a duplicate form and use that form instead on the page, and number the results.php (as suggested in those same instructions you mentioned).