Thanks for the post.
The above code should list the Taxonomy terms, but if you are calling the Tax field outside the main posts loop, you might need to add a second parameter to the get_field() function and this should be a string containing the post->ID that the field is referenced in.
Your overall snippet should then look like so:
<?php $terms = get_field('taxonomy_field_name', 123); //123 is the numerical post id identifier if( $terms ): ?> <ul> <?php foreach( $terms as $term ): ?> <h2><?php echo $term->name; ?></h2> <p><?php echo $term->description; ?></p> <a href="<?php echo get_term_link( $term ); ?>">View all '<?php echo $term->name; ?>' posts</a> <?php endforeach; ?> </ul> <?php endif; ?>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2023 Advanced Custom Fields.