Home › Forums › General Issues › How to taxonomies and display taxonomy acf image only primary › Reply To: How to taxonomies and display taxonomy acf image only primary
This code is work. But image show all i need a show only priamry and link to “company_categories” how to fix?
<?php
$terms = get_the_terms (
$post->ID, 'company_categories'
);
foreach($terms as $term) {?>
<?php
$image = get_field('company_profile', 'company_categories_' . $term->term_id);
if( !empty($image) ): ?>
<picture href="">
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" width="250" height="250" />
</picture>
<?php endif; ?>
<?php } ?>
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.