Skip Navigation

[Resolved] Creating views with specific taxonomy terms

This thread is resolved. Here is a description of the problem and solution.

Problem:

I've been requested to add an additional taxonomy for English and Spanish languages.

My question is whether it is best to use a new Custom Field or a new Taxonomy to distinguish the languages?

Also, how can I set up a separate language views?

Is there a tutorial of some sort?

Solution:

It depends on your website request, if your website will add more languages in the future, I suggest you try with custom taxonomy "languages", so you will be able to add more terms when you create/edit a "Channels" post.

If there are only two "languages" items in your website in the future, then you can setup it as a custom field "languages", then all the options are controlled by website administrator.

If it is a taxonomy "languages", you can add a filter in your post view:

Value set by View shortcode attribute "languages"

Then display the view's shortcode like this:
[wpv-view name="MY-VIEW-NAME" languages="english"]
[wpv-view name="MY-VIEW-NAME" languages="Spanish"]

Relevant Documentation:

https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

This support ticket is created 6 years, 1 month 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/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by michaelH-31 6 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1160120

I created a Custom Post Type called "Channels" with various custom fields and taxonomies. The final output can be viewed on my dev site - hidden link

Now I've been requested to add an additional taxonomy for English and Spanish languages.

My question is whether it is best to use a new Custom Field or a new Taxonomy to distinguish the languages? Also, how can I set up a separate language views? Is there a tutorial of some sort? The final output should look basically the same as what I've already done.

Thanks so much for your help.

#1160480

Hi,

Q1) My question is whether it is best to use a new Custom Field or a new Taxonomy to distinguish the languages?
It depends on your website request, if your website will add more languages in the future, I suggest you try with custom taxonomy "languages", so you will be able to add more terms when you create/edit a "Channels" post.

If there are only two "languages" items in your website in the future, then you can setup it as a custom field "languages", then all the options are controlled by website administrator.

Q2) Also, how can I set up a separate language views?
If it is a taxonomy "languages", you can add a filter in your post view:
Value set by View shortcode attribute "languages"

Then display the view's shortcode like this:
[wpv-view name="MY-VIEW-NAME" languages="english"]
[wpv-view name="MY-VIEW-NAME" languages="Spanish"]

More help:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

If it is a custom field, you can add a field filter by View shortcode attribute "languages"
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/#source-for-compare-value
Shortcode attribute The value for the filter comes from an attribute in the View shortcode
You’ll be able to insert the same View in different places and control content filtering via the View Shortcode.

Here is a document about "Passing Arguments to Views"
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
section "Controlling the filter with shortcode attributes"

For your reference.

#1160671

My issue is resolved now. Thank you!