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.
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.