Loop: Custom Taxonomy
This chunk lists all the Categories or Taxonomies of a Custom Post Type (in this case events
). You can also get ACF fields.
Usage:
<?php /* events - taxonomy name */ $taxonomy = 'events'; $tax_terms = get_terms( array( 'taxonomy' => $taxonomy, 'hide_empty' => false, )); foreach ($tax_terms as $term_single) { // ACF - Taxonomy Custom Field $custom = get_field('field_name', $taxonomy . '_' . $term_single->term_id); ?> <div class="item"> <a href="<?php echo esc_url( get_term_link( $term_single ) ) ?>"> <h3><?php echo $term_single->name ?></h3> <div><?php echo $custom ?></div> </a> </div> <?php } ?>