I’m not sure there’s a way to get at the full queried object for this (as to count # of post/search hits), but through the use of a custom loop you could collect all posts from the search query, count them up, then display that result:
<?php
$search_count = 0;
$search = new WP_Query("s=$s & showposts=-1");
if($search->have_posts()) : while($search->have_posts()) : $search->the_post();
$search_count++;
endwhile; endif;
echo $search_count;
?>
Wow! This is excellent. Works like a charm.
A shorter version is just to skip the loop entirely.
$mySearch =& new WP_Query("s=$s & showposts=-1");
$NumResults = $mySearch->post_count;
I use this plugin
Results count 0.1
By Matthew Taylor.
Adds info to search results for how many matches were found
http://www.mtaylor.co.uk/wordpress/resultscount.phps
but his site is not working for me today 🙁
After using posts_nav_link(), one can display the number of search results by doing this:
<?php global $max_num_pages, $paged, $posts_per_page; $wp_query;
if ($max_num_pages > 1)
{
echo ‘Showing results ‘;
echo $posts_per_page * $paged – $posts_per_page + 1;
echo ‘-‘;
echo $posts_per_page * $paged – ($posts_per_page – $wp_query->post_count);
echo ‘ of ‘;
echo $max_num_pages * $posts_per_page – ($posts_per_page – $wp_query->post_count);
}
?>