I have looked at the file and indeed the structure of the HTMl is that of a non-infinite scroll results.php file.
It will need to be modified/edited to be usuable for infinite scroll.
If you look in the plugin folder, there is a templates sub folder with examples of normal pagination and infinite scroll, to help you re-code it.
For me it might look like this instead?
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode - think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags -
*
* http://codex.wordpress.org/Template_Tags
*
*/
if ( $query->have_posts() )
{
?>
<!-- ***********************************************************************************************************
products
************************************************************************************************************* -->
<div class="found">Found <?php echo $query->found_posts; ?> Results<br /></div>
<div class="search-filter-results-list products-list-area">
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class="search-filter-result-item products-list-item w_addt_image">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<!-- 1st image from gallery on hover -->
<?php $addt_image = get_field('nr_additional_images'); if( $addt_image ): ?>
<div class="products-list-item-img-wrap addt_image">
<img src="<?php echo $addt_image[0]["sizes"]["large"]; ?>">
</div>
<?php else: ?>
<div class="products-list-item-img-wrap addt_image">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<?php $product_thumb = get_the_post_thumbnail(''); if( !empty($product_thumb) ): ?>
<div class="products-list-item-img-wrap">
<?php the_post_thumbnail(); ?>
</div>
<?php else: ?>
<div class="products-list-item-img-wrap">
<img src="http://placehold.it/300x300/e5e5e5/ffffff?text=Image+Not+Available" alt="">
</div>
<?php endif; ?>
</a>
<div class="details">
<!-- <div class="product-material-and-collection"><?php the_field('nr_material'); ?> | <?php the_field('nr_collection'); ?></div> -->
<div class="product-material-and-collection">
<?php
$field1 = get_field_object('nr_material');
$materials = get_field('nr_material'); // array of selected values
$resultstr = array();
foreach ($materials as $material) {
$resultstr[] = $field1['choices'][ $material ];
}
echo implode(", ",$resultstr);
?>
|
<?php
$field = get_field_object('nr_collection');
$value = $field['value'];
$label = $field['choices'][ $value ];
?>
<?php echo $label; ?>
<?php the_favorites_button($post_id, $site_id); ?>
</div>
<div class="product-name">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
</div>
</div>
<?php
}
?>
</div>
<?php
}
else
{
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>End of Results</span>
</div>
<?php
}
?>
If you are using our Shortcode results method, you can customise the results.php file, where the HTML structure, divs etc, can be found. See here for how:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
The lines (#29&30) you may want to add a wrapper around at the top is this:
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
Maybe like this:
<div class="top-found-post-pages"><p>Found <?php echo $query->found_posts; ?> Results</p>
<p>Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?></p></div>
And at the bottom the line is by default #73
You can edit the file where you want and the HTML also.
IT IS RECOMMENDED TO USE A CHILD THEME.
You can easily make a child theme using a plugin from Orbisius. Follow the default settings and it should work. You can remove the child theme maker plugin after use.
It would have to be coded into the PHP template file that you are using to display the results. If you are refereshing he results using ajax, that code would need to be running inside the Ajax Container, otherwise it will not update.
A simple code example follows, the wp_query() results array name will be particular to your theme. Many themes use the array name $query
, so my example will do that also:
<p>Found <?php echo $query->found_posts; ?> Results</p>
If you are using our Shortcode results method, you can customize the results.php file, where the HTML structure, divs etc, can be found. See here for how:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
The line (#29) you may want to remove is this:
Found <?php echo $query->found_posts; ?> Results<br />
You can edit the file and messages also.
IT IS RECOMMENDED TO USE A CHILD THEME.
You can easily make a child theme using a plugin from Orbisius. Follow the default settings and it should work. You can remove the child theme maker plugin after use.
AnonymousInactive
Hello –
Do you know what I’m doing wrong here?
I’m trying to display the two below ACF custom fields in my search results, but they don’t show up. What is the correct way to display them?
Thanks!
name: employer Type: Relationship
name: salary Type: Text
<?php the_field(’employer’); ?>
<?php the_field(‘salary’); ?>
—-
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/
if ( $query->have_posts() )
{
?>
<h5 style=”#70757a”>Found <?php echo $query->found_posts; ?> Results<br /></h5>
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />
<div class=”pagination”>
<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>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class=”job-search-results”>
<h2>“><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
echo ‘<p>’;
the_post_thumbnail(“small”);
echo ‘</p>’;
}
?>
<div class=”search-results-employer”><h5>Employer Name: <?php the_field(’employer’); ?> </h5></div>
<div class=”search-results-employer”><h5>Salary: <?php the_field(‘salary’); ?> </h5></div>
<div class=”search-results-location”><h5><?php the_terms( 0, ‘city’); ?>, <?php the_terms( 0, ‘job_country’); ?></h5></div>
<div class=”search-results-skills”><h5>Skills: <?php the_terms( 0, ‘job_expertise’); ?> </h5></div>
<div class=”search-results-date”><h5><small><?php the_date(); ?></small></h5></div>
</div>
<hr />
<?php
}
?>
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />
<div class=”pagination”>
<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>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists(‘wp_pagenavi’))
{
echo “<br />”;
wp_pagenavi( array( ‘query’ => $query ) );
}
?>
</div>
<?php
}
else
{
echo “No Results Found”;
}
?>
Are you using our shortcode display results method?
If so, this is a modified exemplar results.php file to account for this behavior:
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link http://www.designsandcode.com/
* @copyright 2015 Designs & Code
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode - think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags -
*
* http://codex.wordpress.org/Template_Tags
*
*/
if ( $query->have_posts() ) {
?>
Found <?php echo $query->found_posts; ?> Results<br />
<div class='search-filter-results-list'>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class='search-filter-result-item'>
<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>
<hr />
</div>
<?php
}
?>
</div>
<?php
} else {
//figure out which type of "no results" message to show
$message = "noresults";
if(isset($query->query['paged'])) {
if($query->query['paged']>1){
$message = "endofresults";
}
}
if($message=="noresults") {
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>No Results Found</span>
</div>
<?php
} else {
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>End of Results</span>
</div>
<?php
}
}
?>
That does not look right. It might look like this:
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode – think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags –
*
* http://codex.wordpress.org/Template_Tags
*
*/
if ( $query->have_posts() )
{
?>
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
<div class="pagination">
<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>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists('wp_pagenavi'))
{
echo "<br />";
wp_pagenavi( array( 'query' => $query ) );
}
?>
</div>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div>
<h2>"><?php the_title(); ?></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>
</div>
<hr />
<?php
}
?>
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
<div class="pagination">
<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>
<?php
/* example code for using the wp_pagenavi plugin */
if (function_exists('wp_pagenavi'))
{
echo "<br />";
wp_pagenavi( array( 'query' => $query ) );
}
?>
</div>
<?php
}
else
{
echo "No Results Found";
}
?>
Hi Brian
Its not possible yet.
There is a workaround you can do though.
Inside your results area (the area you defined as your Ajax Container
), you can add a hidden input:
<input type="hidden" name="number-of-posts" value="<?php echo $query->found_posts; ?>" id="number-of-posts" />
(Depending on your display method, $query
might have a different variable name such as $wp_query
)
Then, in your JS sf:ajaxfinish
event, you can grab the value like:
var noPosts = $('#number-of-posts').val();
Let me know how you get on.
Thanks
You are using the ‘As an Archive’ method, and so will have specified the template to use for the results, which will be a theme template (often either search.php or archive.php, but your setup may be different).
You need to edit that file (or make a re-named copy and use that, preferably in a child theme) and add the PHP code needed to display the message you require. Note that, it should be placed INSIDE the Ajax container you are using, otherwise it will not update when Ajax searches are made.
I do not know what the array variable that your theme uses for the results, but in this example I have assumed this to be $query, but in your theme it could well be different, so do check your theme code if it does not work and edit my code snippet accordingly):
<div class="results-found">Found <?php echo $query->found_posts; ?> Results</div>
You are using the ‘As an Archive’ method, and so will have specified the template to use for the results, which will be a theme template (often either search.php or archive.php, but your setup may be different).
You need to edit that file (or make a re-named copy and use that, preferably in a child theme) and add the PHP code needed to display the message you require. Note that, it should be placed INSIDE the Ajax container you are using, otherwise it will not update when Ajax searches are made.
I do not know what the array variable that your theme uses for the results, but in this example I have assumed this to be $query, but in your theme it could well be different, so do check your theme code if it does not work and edit my code snippet accordingly):
<div class="results-found">Found <?php echo $query->found_posts; ?> Results</div>