Display Search Term and Result Count in WordPress




Add the following code in your search.php file

<h2 class="pagetitle">
 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 class="search-terms">'); 
 echo $key; 
 _e('</span>'); 
 _e(' &mdash; '); 
 echo $count . ' '; 
 _e('articles'); 
 wp_reset_query(); ?>
</h2>





Related Post


Latest Post


Recent Posts Widget

Make sure to never miss a thing...

Get the latest news from the creative industry along with other creative goodies, conveniently delivered to social media.