How loop taxonomies category and their childs efficiently

I’m looking for a way to reproduce what we find on any property on airbnb
(What this place offers)

see random airbnb property

I’m thinking about the best and simplest way to manage this with a taxonomy.
in this taxonomy we’ll say it’s hierarchical and have parent > child terms
for exemple

- room 1
- room 2
- room 3
- item 1
- item 2
- item 3

But the problem with this method is in the selection on ACF or Pods or any others field plugin as you can clearly see
it displays the parent and child terms and it’s very annoying, I don’t have control over the display of the terms and we don’t want the person who is already very busy selecting the items to get confused with the parent terms…

so we’ll say that the solution is to create another field to manage the categories
look carefully at the image

note that I put two other fields to manage the images/svg
Feature image
and svg code an idea to simplify life (it didn’t work in bricks or maybe it’s a bad idea)
this creates other problems… imagine you have 200 terms so 200 svg to upload it’s not practical

if one day bricks integrates custom icon pack to upload it will be easier to manage. (but today we must suffer for science )

back in the editor this is the part where I’m stuck

I can’t understand how to display a single loop that understands that we have category features and an associated items to display them

if you figured out how to do it or have a better idea please share your knowledge :pray:

PS: the logic of making a loop for each category is not good because it implies that the categories are fixed in advance but in our scenario we have to remain flexible

You need 2 query loop, nested.

First query

Set “parent” to 0.
Enable “Current post terms”

You will get only top level terms:

  • Bathroom
  • Bedroom and laundry

Second query

Nest this query in the first one.
Set “parent” to “{term_id}”.
Enable “Current post terms”

Take a look at

1 Like