Hi Everyone,
In the newest plugin version, the taxonomy term loop now supports children=true
. (Thanks for the suggestion, Ben!) It’s basically the opposite of parents=true
, which gets only the top-level terms.
A list of top-level parent terms belonging to the current post:
<Taxonomy development parents=true>
...
</Taxonomy>
A list of (non top-level) child terms:
<Taxonomy development children=true>
This one is strange though, I’m not sure in what situation it can be useful.
I think what’s more natural is to get the children of each top-level term, like:
<Taxonomy development parents=true>
Town: <Term name /><br>
Subdivisions:<br>
<Loop field=children>
<img src="{Term image_of_this_subdivision}" width="500" height="600"/>
</Loop>
</Loop>
That should work, but I’m not 100% sure about the child term field - it might be necessary to replace Term
with Field
.
Thank you, Emmanuel, for helping in various discussion topics. I’ve been too busy to respond to all the posted questions in a timely manner, so your input is much appreciated.
Your example using field=parent
is an interesting solution. It works because the loop gets all taxonomy terms belonging to the current post, then filters for only the terms which have a field called “parent”. For top-level parent terms, that field is empty.