If we need to show the number of posts returned from query

First we need to initialize the global variable global $wp_query

And the entire code will be

<?php
global $wp_query; 
echo $wp_query->found_posts;
?>

Leave a Reply

Your email address will not be published.