Skip Navigation

[Resolved] Limiting the number of taxonomy terms

This support ticket is created 4 years, 6 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by edF-5 4 years, 6 months ago.

Assisted by: Shane.

Author
Posts
#1724023

Hi there,

I've created a view that lists the three most recently created custom posts (called "resources"). Each resource has a taxonomy named "subject terms." I'd like to only list (in alphabetical order) the first, say, three terms for each resource. The default is to list all terms. Is there a way to do this in the Toolset interface, or do I need to write a custom PHP function? Could I create a nested view in the Toolset interface, for example?

Thanks for your help!

Saul

#1724143

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ed,

Thank you for getting in touch.

In order to achieve this you will need to use a nested view setup and set the taxonomy view limit and offset option to 3, this means that your view will only list out the first 3 taxonomies it finds.

Then you can also sort the view by the taxonomy title in alphabetical order.

Thanks,
Shane

#1725721

Thanks, Shane. This makes sense. One follow-up question: in the nested view, how do I specify that the taxonomy terms are "related" to the post in the parent view?

#1725805

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-08-03 at 9.58.51 AM.png

Hi Ed,

See my screenshot

There should be a taxonomy term filter for the view and you only need to select "Set by the current post"

Please let me know if this helps.
Thanks,
Shane

#1726143
query-filter.png
content-selection.png

Shane,

My query filter dialog looks *very* different. See query-filter.png. Did you select the "Taxonomy" option from the Content Selection field? See content-selection.png.

Saul

#1726167

Nevermind! I see how you got to that screen. After adding the query filter, you selected "Taxonomy filters > Taxonomy term" from the "Filter by" menu.

Thank you!

Saul