
Hi John – thanks for your reply, sorry about the delay but I’ve been a bit unwell recently. Back on track now but still can’t get this code to work. I get the error “Uncaught Error: Call to undefined function get_post_terms()…”
This is the code I’ve used
<?php
$linked_organisation = get_field('linked_organisation');
if ($linked_organisation) {
foreach ($linked_organisation as $l) {
$terms = get_post_terms($l->ID, 'accreditations');
if ($terms) {
foreach ($terms as $term) {
// get fields from term
$caturl = get_field('accreditation_url', $term);
$catname = $term->name;
$catimg = get_field('accreditation_logo', $term);
$catimgurl = $catimg['url'];
$catimgalt = $catimg['alt'];
$size = 'full'; // (thumbnail, medium, large, full or custom size)
?>
<div>
<?php if ( empty( $catimgurl ) ): ?>
<h3><?php echo $catname; ?></h3>
<?php endif; ?>
<?php if( $caturl ): ?>
<a href="<?php echo $caturl; ?>">
<?php endif; ?>
<?php if ( !empty( $catimgurl ) ) { ?>
<img src="<?php echo $catimgurl; ?>"
alt="<?php echo $catimgalt; ?>" />
<?php if( $caturl ): ?>
</a>
<?php endif; ?>
<?php } ?>
</div>
<?php ;
}}}}
?>
Anything you can suggest would be appreciated. Thanks, Mat