Forums Forums Search & Filter Pro count of total posts?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #238223

    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

    Trevor
    #238252

    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.

Viewing 2 posts - 1 through 2 (of 2 total)