{"id":1419,"date":"2009-10-21T19:59:27","date_gmt":"2009-10-22T02:59:27","guid":{"rendered":"http:\/\/softbeam.net\/hobby\/?p=1419"},"modified":"2009-10-21T19:59:27","modified_gmt":"2009-10-22T02:59:27","slug":"how-to-display-the-number-of-results-in-wordpress","status":"publish","type":"post","link":"https:\/\/softbeam.net\/hobby\/?p=1419","title":{"rendered":"How to display the number of results in wordpress"},"content":{"rendered":"<p>Open your search template file, search.php. In it, search for the following:<\/p>\n<blockquote>\n<pre>&lt;h2 class=\"pagetitle\"&gt;Search Results&lt;\/h2&gt;<\/pre>\n<\/blockquote>\n<p>Now replace this with:<\/p>\n<blockquote>\n<h2 class=\"pagetitle\"><\/h2>\n<\/blockquote>\n<blockquote>\n<pre>&lt;h2 class=\"pagetitle\"&gt;Search Result for &lt;?php \/* Search Count *\/ $allsearch = &amp;new WP_Query(\"s=$s&amp;showposts=-1\"); $key = wp_specialchars($s, 1); $count = $allsearch-&gt;post_count; _e(''); _e('&lt;span class=\"search-terms\"&gt;'); echo $key; _e('&lt;\/span&gt;'); _e(' &amp;mdash; '); echo $count . ' '; _e('articles'); wp_reset_query(); ?&gt;&lt;\/h2&gt;<\/pre>\n<\/blockquote>\n\n\n<p>For showing own avatar registered at Gravatar, add the following to functions.php<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>function<\/strong> get_ssl_avatar($avatar) {\n   $avatar = preg_replace('\/.*\\\/avatar\\\/(.*)\\?s=([\\d]+)&amp;.*\/','&lt;img src=\"https:\/\/secure.gravatar.com\/avatar\/$1?s=$2\" class=\"avatar avatar-$2\" height=\"$2\" width=\"$2\"&gt;',$avatar);\n   return $avatar;\n}\nadd_filter('get_avatar', 'get_ssl_avatar');<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Open your search template file, search.php. In it, search for the following: &lt;h2 class=&#8221;pagetitle&#8221;&gt;Search Results&lt;\/h2&gt; Now replace this with: &lt;h2 class=&#8221;pagetitle&#8221;&gt;Search Result for &lt;?php \/* Search Count *\/ $allsearch = &amp;new WP_Query(&#8220;s=$s&amp;showposts=-1&#8243;); $key = wp_specialchars($s, 1); $count = $allsearch-&gt;post_count; _e(&#8221;); _e(&#8216;&lt;span class=&#8221;search-terms&#8221;&gt;&#8217;); echo $key; _e(&#8216;&lt;\/span&gt;&#8217;); _e(&#8216; &amp;mdash; &#8216;); echo $count . &#8216; &#8216;; _e(&#8216;articles&#8217;); wp_reset_query(); &hellip; <a href=\"https:\/\/softbeam.net\/hobby\/?p=1419\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to display the number of results in wordpress&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1419","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=\/wp\/v2\/posts\/1419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1419"}],"version-history":[{"count":0,"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=\/wp\/v2\/posts\/1419\/revisions"}],"wp:attachment":[{"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softbeam.net\/hobby\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}