I think my problem is similar to what’s been going on here, but I’m still coming up blank.
I have a taxonomy field (checkbox, so multiple items can be chosen) inside a custom post type. So far so good. My query displays the selected taxonomies.
But within those custom taxonomy terms I’ve added a FontAwesome field, so each term has an icon associated with it.
What I’m trying to do is display all icons of terms selected within the custom post.
Here’s my code so far (like I said, the term name itself is displaying just fine, but I want the icon associated with that term to be displaying):
<?php $terms = get_field('tech_choices'); $cat_icon = get_field('creative_icon', $queried_object); ?> <span> <?php if( $terms ): ?> <ul> <?php foreach( $terms as $term ): ?> <li><a href="<?php echo get_term_link( $term ); ?>"><?php echo $term->name; ?></a></li> <?php $icon = get_field('creative_icon', $term->taxonomy . '_' . $term->term_id); echo $icon; ?> <?php endforeach; ?> </ul> <?php endif; ?> </span>
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!
© 2022 Advanced Custom Fields.