I have a postype "Objet" that uses 3 types of custom taxonomies :
- 2 of them are flat and there is no issue
- The 3rd one is hierarchical and I'm not sure on how to manage this.
This hierarchy is as follow :
- Lamps
- Bulbs
- Bayonets
- Led
I have a menu that list all first level taxonomies (ie Lamps here). I want to be able to display all postypes that are related to Lamps (Bulbs + Bayonets + Led) in a first step (then, I have created a search filter that enables to check / uncheck the different sub-taxonomies in the Views).
For achieving this, do I need to check on each post the chosen taxonomy AND the hierarchical taxonomy (ie : Bulbs + Lamps) or is there a way to display all postypes with a taxonomy that is under a hierarchical one (ie Lamps for this example)?
Regards
Pat
You will need to check each hierarchy that the item belongs to, so even if the item is an LED item you must also check the Lamp Parent term as well for the filter to work as you intend it to.
Hi Shane, Thanks for your answer.
The issue for me is that the taxonomy is defined by the user in frontent (Cred) and I'm not willing to ask them to check several taxonomies. Is there a way to check the parent taxonomy automatically when a child is checked ?
Unfortunately no, something like this would need to be done using custom coding, which custom coding like this is out of the scope of our support forum.
If you have a large amount of taxonomies you will need to do an additional condition to ensure that it is checking the correct item
I think this is a kind of feature that Toolset should propose as standard. How can you manage the hierarchical taxonomies if you are not able within Cred, to check in the same time, the desired taxonomy and the parent's one ?
In this case, the hierarchical is not of any help !!!
Any idea?
regards
Pat
Thats because this is functioning the same on the backend. Remember that on the backend it is possible to select the child without selecting the parent.
What Toolset Forms does is to simply bring this functionality to the frontend. So wordpress itself doesn't have this feature so our Forms wouldn't as well.
What I'm thinking is that you can use the CRED hook to see which item is selected and add the parent when the form is selected. However the code will need to account or check for all the options.
So if you have 25 parent and 30 child terms. Then you need to run through all 30 child terms and check if the parent of that term is selected and if its not then you need to add it.
In hindsight is much simpler to let users know to select the parent as well.
I'm OK to use Forms hook like cred_before_save_data
The issue for me is to recover the parent taxonomy from a specific one.
Can you help on this please
Thanks
Pat