acf taxonomy field get woocommerce category image code example

Example: retrive acf from taxonomy

<?php // ACF in Taxonomy

// get the current taxonomy term
$term = get_queried_object();


// vars
$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 // Remaining template removed from example ?>

Tags:

Php Example