A
A
Andrey Iginov2020-04-17 06:30:53
WordPress
Andrey Iginov, 2020-04-17 06:30:53

How to display a child element separately from the parent from a custom taxonomy?

Hello! Please tell me, here I have a custom taxonomy "vehicles" and in it the elements of the 3rd level of the hierarchy.
That is:
Parent > child > great-grandchild
And I have a lot of these 3-level hierarchies, and I have 377 elements in general. I'm not sure that I explain correctly and clearly, so here's a screenshot for clarity

5e994237def44962786549.png

. I have a task to display each level of the hierarchy separately on the product page.
That is, on the site it should look like this.
Year(Parent) - list with all years - separately
Make(Child) - list with all manufacturers - separately
Model(Great-grandchild) - List with all models - separately

How do I do this? It would not be very desirable to manually drive in the ID, let me remind you that there are 377 elements. What do you advise?
yes i can use

$args = array(
  'title_li' => '',
  'taxonomy' => 'vehicles',
  'depth' => 1
);

wp_list_categories($args);

to display the "parent" separately, but what about the "child" and "great-grandchild"? I will be glad for any help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-04-18
@andreyiginov

It's not at all clear what you mean by "output separately".
But, if you can call wp_list_categoriesfor the parent, then what prevents you from calling it with a parameter child_offor the children?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question