我有一个分层自定义分类法,可以使用print_r(get_the_terms( $post->ID, \'taxonomic_rank\' ));
:
Array
(
[46] => stdClass Object
(
[term_id] => 46
[name] => Aplocheilidae
[slug] => aplocheilidae
[term_group] => 0
[term_taxonomy_id] => 53
[taxonomy] => taxonomic_ranks
[description] =>
[parent] => 39
[count] => 1
[object_id] => 443
)
[47] => stdClass Object
(
[term_id] => 47
[name] => Aplocheilus
[slug] => aplocheilus
[term_group] => 0
[term_taxonomy_id] => 54
[taxonomy] => taxonomic_ranks
[description] =>
[parent] => 46
[count] => 1
[object_id] => 443
)
[39] => stdClass Object
(
[term_id] => 39
[name] => Cyprinodontiformes
[slug] => cyprinodontiformes
[term_group] => 0
[term_taxonomy_id] => 52
[taxonomy] => taxonomic_ranks
[description] =>
[parent] => 0
[count] => 1
[object_id] => 443
)
)
这种分类法将始终采用以下形式:Order (家长)>Family (订单的子项)>Sub-family (家庭子女)是否有一种快速简便的方法可以按正确的顺序显示这些分类法,以便我可以打印出以下行?Order: <order>, Family: <family>, Sub-family: <sub-family>
提前感谢