Forums › Forums › Search & Filter Pro › Show search results count
- This topic has 3 replies, 2 voices, and was last updated 4 years, 11 months ago by Trevor.
-
Anonymous(Private) December 4, 2019 at 9:34 pm #228396
How can we show the number of search results on the results page? We are testing this on our staging site, and currently the title of the page shows only “Archives”. If you want to see this, I can send a link in a private reply.
Our previous search (which used Search Everything) shows the count at the top of the page. (For example: https://www.mbari.org/?sfid=1350&s=smith)
Any suggestion?
Thank you!Trevor(Private) December 5, 2019 at 11:48 am #228450It 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>
Anonymous(Private) December 12, 2019 at 12:26 am #228917Hi Trevor,
Thank you! That was helpful. We now have Search and Filter running on our production site. Unfortunately, the search results are not the same as we have been seeing on our staging site.
As far as we can tell, all our settings are the same on our staging site and on our production site. If we search for a staff member’s name on staging his/her individual page usually comes up pretty high in the search results. For instance, search for “Krystle” and http://www.mbari.org/anderson_krystle shows up at the top of the results. On our production site, it shows up at the bottom.
Note that we do not have the search order set in either site. And, even when we changed the Default Order under the “Posts” tab, it does not change the search order. Maybe I am missing a setting?
Thank you for your help.
Trevor(Private) December 12, 2019 at 1:57 pm #228982If you make a change to the order in the Posts tab of our plugin, and that is not reflected in the results, and yet the results are otherwise correct, then either them theme, some custom code, or another plugin is altering the order. The most likely are Post Type Order or Category Order plugins, as these tend to use pre_get_posts() to make a late change to any archive loop output (after the query has been run).
-
AuthorPosts