How to show all the possible parents and children of a hierarchical taxonomy term?

I have a personalized hierarchical taxonomy "company"

Companies are hierarchical, they can have both owners and subsidiaries. So, some of my "company"The terms have parents and children, let's take this real example of a set of my"company"terms

  • WPP
    • 24/7 realmedia
    • AKQA
    • Group m
      • Finecast
      • Group M Entertainment
      • Maxus
      • MEC
      • Mediacom
      • Modi Media
      • Real Media Group
      • Xaxis
    • JWT
    • Kantar
      • Kantar Media
      • TNS Media Intelligene
    • Millward Brown
    • Ogilvy
    • Possible
    • VML
    • Ripple
    • Wunderman

What I would like to do, in a company The term page is to show the complete corporate tree, as shown above, to locate the term in its full hierarchical context.

That does not go only for the highest term, for example. "WPP", but also a child of the middle hierarchy or a grandchild, for example. "GroupM" or "Ogilvy Entertainment.

I do not mean all the terms in the "company"Taxonomy, I mean all the terms above and below the given term, including the children of the higher terms.

In other words, for any term, back up the top and show all the sub terms correctly, in a list of indented HTML, preferably with something unique applied to the current term title, for example. do not get_term_link applied.

What I have so far is the following …

      & # 39; fake & # 39;
);
echo get_term_parents_list ($ organization-> term_id, & # 39; company & # 39 ;, $ parent_args);
?>


      term_id, & # 39; company & # 39; // Get secondary terms of this

eco & # 39;
    & # 39 ;; foreach ($ org_children as $ org_child) { $ child_term = get_term_by (& # 39; id & # 39 ;, $ org_child, & # 39; company & # 39;); $ child_id_prefixed = & # 39; company _ & # 39 ;. $ child_term-> term_id; if (empty (get_field (& # 39 ;, $ child_id_prefixed)) { $ favicon = & # 39; null & # 39 ;; } else { $ favicon = get_field (& # 39 ;, $ child_id_prefixed); } eco & # 39;
  • & # 39; $ child_term-> name. & # 39;
  • & # 39 ;; } eco & # 39;
& # 39 ;; ?>

What this produces …

enter the description of the image here

However, this:

  1. It is a two step process, in which I get parents and children (I prefer a unique process).
  2. The output is not a list with indentation.