Skip Navigation

[Resolved] Count items in using a taxonomy on a related post

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 1 reply, has 2 voices.

Last updated by Waqar 7 months, 3 weeks ago.

Assisted by: Waqar.

Author
Posts
#2696295

Tell us what you are trying to do?

I am trying to count the number of wineries visited based on the taxonomy of the winery.

I have a "wineries visited" post that relates to "wineries"

A user can log a new "winery visited", which uses the relationship to show the winery.

My client would like to show the number of wineries the user has visited based on a taxonomy on the winery.

So - a client visits four wineries that have the Wine Trail Taxonomy term of "Cheers". I want to show that number on their account page.

It would also be really cool to only count "unique" wineries in that taxonomy - for example, a person could visit the same winery twice - I'd love to be able to count that as only one in this particular count. They want to give "badges" to users who have visited all the wineries associated with a particular taxonomy term.

Is there any documentation that you are following?

https://toolset.com/forums/topic/count-number-of-entries-in-repeating-field/#post-1207355
But this isn't a repeating field - it is a taxonomy.

Is there a similar example that we can see?

What is the link to your site?
hidden link

#2696342

Hi,

Thank you for contacting us and I'd be happy to assist.

To achieve something like this, you can create a view that shows the "winery visited" by a user, filtered by the current user as a post author.

In the loop of this parent view, you'll add another view that will show the "wineries" related to the current loop item ("winery visited") and filtered by the target taxonomy term.

The last step would be to add some custom JS script, that will calculate the number of unique result items ("wineries") found on the page, as a result of these two views.

I hope this helps and please let me know if you need further assistance.

regards,
Waqar