Forums › Forums › Search & Filter Pro › Results count
- This topic has 7 replies, 2 voices, and was last updated 4 years, 3 months ago by Trevor.
-
Anonymous(Private) July 30, 2020 at 6:27 pm #254656
Hi Trevor,
I wish to display the number of results generated by a query on the search results page. I found how to get the search term in your documentation.
$sf_current_query = $searchandfilter->get($id)->current_query();
$term = $sf_current_query->get_search_term();How do I get the number of results?
Thank you,
Christian
Anonymous(Private) July 31, 2020 at 11:57 am #254714Trevor,
I did try this:
$sf_current_query = $searchandfilter->get($id)->current_query();
$term = $sf_current_query->get_search_term();
$count = $sf_current_query->found_posts;I returns the term, but not the count. How can I get the results count from the Search and Filter query?
Thank you,
Christian
Anonymous(Private) July 31, 2020 at 12:31 pm #254723Trevor,
It is a custom search results page. In the header, I wish to display the results count and the search term(s). Below that is a standard loop:
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘loop-templates/content’, get_post_format() ); ?>
<?php endwhile; ?>Thank you,
Christian
-
AuthorPosts