It would depend on how you template and query in your theme is constructed, but the standard WordPress Codex code to display the number of results looks like this:
<?php echo $query->found_posts; ?>
but then you would need to find (do a Google search) for how to find the total number of posts (of the post types that you are searching).
Ah, I see. You have three possible output combinations.
Try this:
<?php global $searchandfilter;
$sf_current_query = $searchandfilter->get(2398)->current_query();
$searchTerm = $sf_current_query->get_search_term();
$args = array(
"str" => '%2$s',
"delim" => array(", ", " - "),
"field_delim" => ', ',
"show_all_if_empty" => false
);
?>
<?php global $wp_query;
$fields_html = $sf_current_query->get_fields_html( array("_sft_clinical-area", "_sft_program", "_sft_type"), $args);
if (( $searchTerm <> "" ) && ( $fields_html <> "" ) ){
$field_delim = ', ';
} else {
$field_delim = '';
}
echo $wp_query->found_posts; ?>
Search Results for <?php echo $searchTerm . $field_delim . $fields_html; ?>
Maybe?
AnonymousInactive
The full results code… `<?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 />
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=”results-inline-search”>
<?php
global $post;
$pod_name = ‘Promotions’;
//get pods object
$pods = pods( $pod_name, $post->ID );
echo $pods->template(“my_search_loop”);
?>
</div>
<?php
}
?>
<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
}
else
{
echo “No Results Found”;
}
?>`
My guess is that you are using the shortcode display results method? If os, follow this customising guide:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
And edit the local theme folder copy of results.php and find and remove this:
Found <?php echo $query->found_posts; ?> Results<br />
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
At the top (on the original file at lines 29 and 30.
And also this line towards the bottom (line 73):
Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
AnonymousInactive
Hi,
I would like to put this function outside of results.php
to place it in a particular place:
Found <?php echo $query->found_posts; ?> Results
But that does not work (normal).
It works if I slightly chance the function:
Found <?php echo $wp_query->found_posts; ?> Results
But it does not update when searching (Ajax).
Is there a way to make it work?
Thanks in advance.
Did you use this (or similar?):
Found <?php echo $query->found_posts; ?> Results
You will need to follow the instructions for making a custom results.php file here:
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
However, you need to change the contents of the standard results.php file to the content of the infinite scroll version, which look like this:
<?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
{
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>End of Results</span>
</div>
<?php
}
?>
AnonymousInactive
Hello,
Infinite scroll seems to no longer be working. Here is the code I’m using for the results page which I customized and got the base from results-infinite-scroll.php. I have the file in my child theme in a folder titled “search-filter”. The custom results are showing but infinite scroll is a no go. Please advise. I already deactivated all plugins and even switched my theme over to twenty seventeen to test and infinite scroll does nothing. It was working a few weeks back showing the loader animation and then showing more results. My site is blocked inside a a firewall and cannot share the URL but my code for the results page is below.
<?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'>
<!--MMC - Start custom results code -->
<div class="resource-wrap">
<div class="resource-tab">
<?php $terms = get_the_terms( $post->ID , ( 'resource_type' ) );
// init counter
$i = 1;
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, ( 'resource_type' ) );
if( is_wp_error( $term_link ) )
continue;
echo '<a>slug . '" href="' . $term_link . '">' . $term->name . '</a>';
// Add comma (except after the last theme)
echo ($i < count($terms))? ", " : "";
// Increment counter
$i++;
}
?>
</div>
<div class="clr"></div>
<a>"><?php
if ( has_post_thumbnail() ) {
echo '<div class="resource-photo">';
the_post_thumbnail("small");
echo '</div>';
}
?></a>
<div class="resource-content">
<ul class="meta clr meta-with-title">
<li><?php echo get_the_date(); ?></li>
<!--<li><?php /*$terms = get_the_terms( $post->ID , ( 'resource_author' ) );
// init counter
$i = 1;
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, ( 'resource_author' ) );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">'. '<span class="fa fa-user" aria-hidden="true"></span>' .' ' . $term->name . '</a>';
// Add comma (except after the last theme)
echo ($i < count($terms))? ", " : "";
// Increment counter
$i++;
}*/
?></li>-->
<li><span class="fa fa-folder-o" aria-hidden="true"></span> <?php $terms = get_the_terms( $post->ID , ( 'categories' ) );
// init counter
$i = 1;
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, ( 'categories' ) );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">' . $term->name . '</a>';
// Add comma (except after the last theme)
echo ($i < count($terms))? ", " : "";
// Increment counter
$i++;
}
?></li>
</ul>
<h3><a>"><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<div class="filtered-results-meta">
<p><strong>Roles:</strong> <?php $terms = get_the_terms( $post->ID , ( 'role' ) );
// init counter
$i = 1;
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, ( 'role' ) );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">' . $term->name . '</a>';
// Add comma (except after the last theme)
echo ($i < count($terms))? ", " : "";
// Increment counter
$i++;
}
?></p>
</div>
</div>
</div>
<!-- MMC - End code -->
<hr />
</div>
<?php
}
?>
</div>
<?php
}
else
{
echo "No Results Found";
}
?>
AnonymousInactive
it not avada theme code its wp theme code. i dont use masonry.
here is the results.php
<?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() )
{
?>
<?php echo $query->found_posts; ?> Ergebnisse gefunden<br />
Seite <?php echo $query->query[‘paged’]; ?> von <?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>
<?php if( have_rows(‘bilder’) ): ?>
<div class=”acf-gallery col-sm-12 col-xs-12 col-md-3″>
<div class=”fusion-gallery fusion-gallery-container fusion-grid-1 fusion-columns-total-10 fusion-gallery-layout-grid” style=”margin: -5px; position: relative; height: 1889.1px;”>
<?php $tmp=0;
while( have_rows(‘bilder’) ): the_row();
$image = get_sub_field(‘url’);
if ($tmp==0) : ?>
<div style=”padding: 5px; display: block; position: absolute; left: 0px; top: 0px;” class=”fusion-grid-column fusion-gallery-column fusion-gallery-column-1 hover-type-zoomin”><div class=”fusion-gallery-image”>” class=”fusion-lightbox” data-rel=”iLightbox[d2dfb9cbd4d28f5c119]” data-caption=””>” alt=”” title=”” aria-label=”” class=”img-responsive wp-image-397″></div></div>
<div class=”clearfix”></div>
<?php $tmp++; ?>
<?php endif; ?>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<div class=”col-sm-12 col-xs-12 col-md-9″><?php the_content(); ?></div>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<div class=”clearfix”></div>
</div>
<div class=”clearfix”></div>
<hr />
<?php
}
?>
Seite <?php echo $query->query[‘paged’]; ?> von <?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”;
}
?>
Have a look at this:
<?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
}
}
?>