just want to check whether anyone has any idea whether this can be done?
ie. to show the number of results from search.
thanks.
Thread Starter
amory
(@amory)
I haven’t found anything yet, however I stopped looking awhile ago.
I’m wondering the same thing. Show the number of search results, just like it shows the number of posts by a category-name. How to do this?
Edit: realised the code posted was incorrect.
This code (taken & modified out of a plugin) should do what you want.
<?php
preg_match('#FROM (.*) GROUP BY#', $request, $matches);
$fromwhere = $matches[1];
$numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
if (0 < $numposts) $numposts = number_format($numposts);
?>
<?php printf(__('Your search found %1$s matching posts'), $numposts, 'edit.php'); ?>