Skip Navigation

[Resolved] How to create a view with Child Taxonomies as filter?

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

Author
Posts
#603551

Hi,
I have 2 questions:

Case 1: Hierarchical Taxonomy
Say I have a hierarchical taxonomy, and I have posts assigned to different levels of this hierarchy. for example:
History (main category)
- Ancient Kingdoms (Second level)
-- Egyptian Kingdoms (third Level).
- Modern Civilizations (Second Level).
-- bla bla (third level)
then I have some posts assigned to the second level (which means they are assigned to the main and second levels) and some posts assigned to the third level (which means that they are assigned to the main, secondary and tertiary levels).

Is there a way to create a view that has a filter that lists these categories automatically, so users can filter the results? but more importantly, automatically so I don't have to edit the view every time I add one of these categories?
------------------
Case 2: flat Taxonomy
Say that the taxonomy is flat. History, Ancient Kingdom...etc

Is there a way to create a filter based on the main taxonomy term (e.g. History), which will bring several posts, then have the view displaying the taxonomy that is contained in the posts?
(so the view detects that "Ancient Kingdoms, Modern Civilizations, Egyptian Kingdoms...etc) are assigned to the posts that has the "History" taxonomy term, then displays them in a filterable list, so visitors can filter through them?
More importantly automatically so I don't have to edit the view every time I add one of these categories?
..
thanks in advance.

#603668

Dear AtefR7377,

Case 1: Hierarchical Taxonomy
Yes, it is possible within Views plugin, see our document:
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/
Value set by URL parameter
To setup the taxonomy filter field in custom search form, please check our document:
https://toolset.com/documentation/user-guides/front-page-filters/
And according to wordpress document:
https://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
include_children (boolean) - Whether or not to include children for hierarchical taxonomies. Defaults to true.
So if you view is filtered by the "second level" term (Ancient Kingdoms), view should return posts assigned to the third level term(Egyptian Kingdoms).

Case 2: flat Taxonomy
In the flat taxonomy, there isn't such kind of "main" taxonomy term, there isn't any relationship between terms "History" and Ancient Kingdoms, Modern Civilizations, Egyptian Kingdoms...etc
So it is not possible to achieve what you want.