- This topic has 1 reply, 2 voices, and was last updated 6 years ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › count of total posts?
Hi,
Our search listing has at the top “Found 5 Events” but what we really want is “Found 5 of 21 Events” where 21 is the number of Events shown when no filters are set. The code we use is:
Found <?php echo esc_html( $query->found_posts ); ?> Events
Is there an easy way for us to find the total Events on the list when no filters are set? The only way I can think of doing this is by writing a select count(*)... call directly to the DB that mimics the same query.
Thanks,
Chris
I don’t think that there isn’t an easy way to do this. You would have to create a second wp_query() for the page solely to calculate this, and your database and server would take a resource hit as a consequence, I suspect.
I would be looking for code snippets on the WordPress section of the StackExchange site.