Been attempting do that and nonetheless no luck. What I am attempting is to listing taxonomy phrases assigned to a publish ordered by parent-child class relationship (hierarchical view).
Construction is one thing like this
Library = customized publish sort
Yr = customized taxonomy assigned to "library"
- 2021 = mum or dad time period
-- April = little one time period
-- Might = little one time period
-- June = little one time period
-- July = little one time period
The specified output is:
2021, April, Might, June, July
I attempted:
$phrases = get_the_terms( $post->ID, 'document_year' );
if ( $phrases && ! is_wp_error( $phrases ) ) :
$output = array();
foreach ( $phrases as $time period ) {
$output[] = $term->title;
}
echo '<span>' . implode ( ', ', $output ) . '</span>';
endif;
However this outputs an alphabetical order of phrases.
Identical with this:
echo ( get_the_term_list( $post->ID, 'class', '', ' / ') );
Any assist please?