I have a Custom Post Type of “projects”, that is categorized by a Custom Taxonomy of “industry”, which is heirarchical. Projects & sub-projects are assigned to the industries. For Example, the “Academic” industry contains, three sub-industries of, University, Community College, & K-12. I need to display the list of projects.
For Example:
Academic
-University
-Community College
-K-12
-- Gordon Elementery
-- West Lake High School
--- Gymnasium
--- Admin Building
--- Cafeteria
-- Jefferson Elementary
Right now, it lists all projects including the subprojects
Basically, if the term has no “sub-terms” it links to the single.php for that term. I also need it to just list the parent term, should that term have “sub-terms” or child terms.
I’ve played around with get_term_children() but just can’t seem to figure out how to work this out. Any suggestions would be greatly appreciated. Thanks
Here is some basic setup for the function that MavBzh mentioned.
I think you should better use the wp_list_categories function and play with the taxonomy parameter.
You’ll then have access to more parameters than with *get_term_children* (depth, parent, child_of, hide_empty, etc.)