I have a project where we have registered a custom taxonomy called "product-category" and have an Advanced Custom Field linked to it called "range_image".
We then have a custom page template (not a category.php or archive.php) page where we are displaying a list of categories and its associated data. All data is displaying perfectly however we cannot pull in the range_image?
Here is the code for pulling in the product-category data:
<?php
$ranges = get_terms( 'product-category', array(
'orderby' => 'count',
'parent' => 1,
'hide_empty' => 0,
));
$counter = 0;
foreach ($ranges as $range):
$counter++;
?>
We can then fetch normal fields like this:
<?php echo $range->name ;?>
Can anyone offer a solution on how we would fetch the ACF field range_image off this query?
All examples we can find reference the following code but it doesnt work:
<?php $image = get_image('range_image', $range->term_taxonomy_id);
echo '<img src="'.$image['url'].'" alt="'.$image['alt'].'" />';
?>
Any help would be appreciated!
Thanks Stan