Skip Navigation

[Resolved] Insert total number of results found by a View without inserting the actual View

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Ben 5 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1191670

Ben

Is it possible to insert the total number of results found within a view using [wpv-found-count] without actually having to insert that View as well?

At the moment I have a View and I can use [wpv-found-count] within that View to output the total number of results found. I want to be able to use this data somewhere else without having to actually display any of the results.

Is this possible?

#1191822

Hi Ben,

Thanks for asking! I'd be happy to help.

The value of shortcode [wpv-found-count] depends on the view's loop, therefore, I'm afraid, it can not be used without the view itself.

You can create a duplicate of your actual view and that new view, add "[wpv-found-count]" after the "<!-- wpv-loop-start -->" line. Next, you can remove everything from inside the tags "<wpv-loop></wpv-loop>".

This way, this new view will output only the number of results and not the complete markup from the actual view.

I hope this helps.

regards,
Waqar

#1192090

Ben

Thanks for the reply Waqar!

Would this work if I inserted the original View into a new View and used [wpv-found-count] with your instructions on the new View?

#1192342

Hi Ben,

Thanks for writing back.

Yes, you can nest the original view into the new one, but since the "[wpv-found-count]" value would be the same for both views, I can't think of a scenario, where they both will be needed to be used together.

Note: in case you need to show the count of view's results, outside its loop, you can also use some custom script, to show it at your desired place, using only a single view, as suggested in this reply:
https://toolset.com/forums/topic/how-to-display-the-total-amount-of-posts-in-search-results-parent-layout/#post-1130495

regards,
Waqar

#1200099

Ben

Thank you for all your help with this Waqar, as well as that very useful information to!