Hello,
Could you please tell me how to display parent and child taxonomy terms in a specific loop format?
I have registered a list of addresses in a hierarchical taxonomy as shown in the attached image. Here is an example of the structure:
Parent: Tokyo
Children: Bunkyo-ku, Setagaya-ku, Minato-ku
Parent: Kanagawa
Child: Yokohama
Grandchild: Kohoku-ku, Naka-ku…
Currently, I can display a single item using code like @post(taxonomy.label).first(). However, I am not sure how to loop through the data to achieve the grouped layout I need.
My Goal: I want to group the display by Parent. I need to loop through each region as a block. For example, if the Parent is “Tokyo”, I want to display only the specific Children belonging to it underneath. Then, loop to the next Parent (“Kanagawa”) and do the same.
Target Layout:
Label: Tokyo Setagaya-ku / Bunkyo-ku
Label: Kanagawa Yokohama-shi / Miura-shi
Is it difficult to achieve this kind of nested loop display?
Thank you.
©2025 Created with 27collective LLC. All rights reserved