Copiez et collez ces lignes de code ci-dessous pour afficher tous les terms d’un post type :
/** * PIT - Archive * - Display "all" terms of "all" taxonomies of a specific post type. */ $post_type = 'post_type'; $post_type_archive_link = get_post_type_archive_link($post_type); $post_type_taxonomies = get_object_taxonomies($post_type); if (!empty($post_type_taxonomies)) : foreach ($post_type_taxonomies as $post_type_taxonomy) : $taxonomy_object = get_taxonomy($post_type_taxonomy); $tax_label_name = $taxonomy_object->labels->singular_name; $tax_label_all_items = $taxonomy_object->labels->all_items; ?> <div class="taxonomy-filter"> <h4> <?php echo ucfirst($tax_label_name); ?> </h4> <a data-term-id="" class="term-link active" href="<?php echo $post_type_archive_link; ?>"> <?php echo $tax_label_all_items; ?> </a> <?php $taxo_terms = get_terms(array( 'taxonomy' => $post_type_taxonomy, 'hide_empty' => false, )); if (!empty($taxo_terms)) : foreach ($taxo_terms as $taxo_term) : $term_id = $taxo_term->term_id; $term_name = $taxo_term->name; $term_link = get_term_link($taxo_term, $post_type_taxonomy); ?> <a data-term-id="<?php echo $term_id; ?>" class="term-link" href="<?php echo $term_link; ?>"> <?php echo $term_name; ?> </a> <?php endforeach; endif; ?> </div> <?php endforeach; endif;