You want to create a search page in WordPress where you count the results and show them on your page, for example: Searching for “apple” gives 3 results.
For getting this search counting you need to add the following code in your search file where you want to show this “counting sentence”.
First we make these variables:
<?php $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; ?>
Then we use $key for showing the search query and $count for how much results.
<p>Searching for "<?php echo $key;?>" gives <?php echo $count;?> results.</p>