acf get taxonomy field recent post code example
Example 1: retrive acf from taxonomy
<?php
$term = get_queried_object();
$image = get_field('image', $term);
$color = get_field('color', $term);
?>
<style type="text/css">
.entry-title a {
color: <?php echo $color; ?>;
}
<?php if( $image ): ?>
.site-header {
background-image: url(<?php echo $image['url']; ?>);
}
<?php endif; ?>
</style>
<div class="wrap">
<?php ?>
Example 2: taxonomy acf
<?php
$term = get_field('taxonomy_field_name');
if( $term ): ?>
<h2><?php echo esc_html( $term->name ); ?></h2>
<p><?php echo esc_html( $term->description ); ?></p>
<?php endif; ?>