Hi all,
I have a website where I list all taxonomies for a certain CPT via a page-template.
Via ACF I’ve added a image-field to the corresponding taxonomy of this CPT, so I can upload a image to each taxonomy created – great!
Now, I cannot figure out how to show this image in this template, where I list the taxonomies for my CPT. Any help pointing in the right direction would be much appreciated 🙂
Code for showing the list of taxonomies attached to the CPT:
$terms = get_terms( 'inspirations-emne' );
echo '<ul>';
foreach ( $terms as $term ) {
// Sanitize the term, since we will be displaying it.
$term = sanitize_term( $term, 'inspirations-emne' );
$term_link = get_term_link( $term, 'inspirations-emne' );
// If there was an error, continue to the next term.
if ( is_wp_error( $term_link ) ) {
continue;
}
// We successfully got a link. Print it out.
echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
Thanks.