Display Custom post type taxonomy’s image and text fields on taxonomy term page using ACF
Display Custom post type taxonomy’s image and text fields on taxonomy term page using Advanced Custom Field. In this code ‘banner’, ‘text-caption’ are my ACF custom field.
Create a rule in Advanced Custom Field group to determine which edit screens will use these advanced custom fields.
The code below you copy paste in the concerned taxonomy php page.
<?php // vars $queried_object = get_queried_object(); $taxonomy = $queried_object->taxonomy; $term_id = $queried_object->term_id; // load desc for this taxonomy term (term object) $thumbnail = get_field('banner', $queried_object); // load desc for this taxonomy term (term string) $thumbnail = get_field('banner', $taxonomy . '_' . $term_id); ?> <?php if(get_field('banner', $taxonomy . '_' . $term_id)): ?> <?php the_field('banner', $queried_object); ?> <!-- For Displaying Custom field image Value --> <?php the_field('text-caption', $queried_object); ?> <!-- For Displaying Custom field text Value --> <?php endif; ?>