Quick Tip 18 – WP Search Results
Another Quick Tip today that improves the search results on your blog. This little snippet of code will recall the search query and the amount of results.
The code below:

<h2>Search Result for <?php /* Search Count */ $allsearch = &new WP_Query(”s=$s&showposts=-1″); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(”); _e(’<span>’); echo $key; _e(’</span>’); _e(’ — ‘); echo $count . ‘ ‘; _e(’articles’); wp_reset_query(); ?></h2>
Open up the search.php file in your theme and replace in the code of the H2 Search Results. Once you have done this and uploaded the file you will see the search query and amount of relevant posts.
Related posts:







