I’m having trouble showing ACF on a custom taxonomy page.
The custom tax is ‘destinations’ with the page being taxomony-destinations.php the field is called ‘destination_landing_image. I’m trying to display it on ‘mysite.com/destinations/coutryname’ as follows:
<?php if (have_posts()) : while (have_posts()) : the_post();
$destination_landing_image = get_field('destination_landing_image');
<img src="<?php echo $destination_landing_image['url'] ?>" alt="<?php echo $destination_landing_image['alt'] ?>">
<?php endwhile; endif; ?>
Oddly enough the page in question does show up the ACF fields within the custom post type(holidays) which is lower in the page. So I guess firstly am I calling it correctly within the loop? and Secondly is a custom taxonomy the right type of page to use?
When you use ACF with posts you can just use
get_field()
as you are, but when you use it with anything else such as taxonomies, users or options, you need to give ACF a hint about how to look it up. In this case you need to tell it what taxonomy and term you are specifically targeting. Luckily both WordPress and ACF make this really easy: