Skip Navigation

[Resolved] Count the terms of a given custom taxonomy

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 1 voice.

Last updated by Saul Baizman 2 days, 20 hours ago.

Assisted by: Minesh.

Author
Posts
#2844636

Hi there,

Before writing a custom shortcode in PHP, I was wondering if there was a Toolset shortcode, or other mechanism, to display the number of terms for a given taxonomy. Note that I don't want the number of terms associated with a specific post, but a count of all of the terms associated with the taxonomy. I tried using [wpv-post-taxonomy] per this webpage (https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-153472), but I think the shortcode is specific to the current post.

Why do I need this, you might wonder? I'm creating a front-end filter and I want to create a CSS grid with the same number of columns as terms (e,g., 5 columns for 5 terms).

Thanks.

Saul

#2844681

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You should first enable the legacy mode of view:
- https://toolset.com/course-lesson/enabling-legacy-version-of-toolset-views/

Then - you should try to create a taxonomy view in legacy mode from Views => Add New and select Taxonomy option and select your desired taxonomy.

And with this view's Loop Editor section just after the [wpv-items-found] shortcode you should try to add the shortcode [wpv-found-count] that will return the total number of count for the found terms.

More info:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-found-count

#2845210

Minesh,

Thanks for your response. This worked perfectly!

Saul