| | |
| | | */ |
| | | public static function getTermPath(WP_Term $term, bool $returnArray = false): string|array { |
| | | if (!is_taxonomy_hierarchical($term->taxonomy)) { |
| | | return $term->name; |
| | | return html_entity_decode($term->name); |
| | | } |
| | | |
| | | $path = []; |
| | | $currentTerm = $term; |
| | | |
| | | while ($currentTerm) { |
| | | array_unshift($path, $currentTerm->name); |
| | | array_unshift($path, html_entity_decode($currentTerm->name)); |
| | | |
| | | if ($currentTerm->parent) { |
| | | $currentTerm = get_term($currentTerm->parent); |
| | |
| | | <span><?= esc_html($termPath) ?></span> |
| | | <button type="button" |
| | | class="remove-term row" |
| | | aria-label="Remove <?= esc_attr($term->name) ?>"> |
| | | aria-label="Remove <?= html_entity_decode($term->name) ?>"> |
| | | <?= jvbIcon('x') ?> |
| | | </button> |
| | | </div> |