Skip to main content
edited tags; edited tags
Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244
Source Link
cnotethegr8
  • 359
  • 2
  • 9
  • 21

Leveled - Terms foreach

I need to build a php foreach that goes through all my terms in my custom taxonomy 'Section'.

I know how to get a foreach of all the terms in 'Section', but what i cant do is build it with levels.

I want the top parent term to be the heading, and its children will be displayed in a list.

Heres an html example of the output i need.

<div class="accordian">
   <div> Term Parent </div>
   <ul>
      <li> Term Child </li>
      <li> Term Child </li>
   </ul>
</div>
<div class="accordian">
   <div> Term Parent </div>
   <ul>
      <li> Term Child </li>
      <li> Term Child </li>
   </ul>
</div>