I've trying to display the number of posts in current page while using pagination. For the total posts among all pages I've used $query->found_posts;
. However, I have no clue about counting post on each page. For example, I want to display Showing 5 of 50 posts Any idea?
Thanks in advance.
CodePudding user response:
Similarly to found_posts
, there's also post_count
, which represents "the number of posts for the current query". So you can use $query->post_count
.