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
Update now finally but i need show only primary someone can help?
<?php
$tax = 'company_categories';
$types = get_terms( $tax, $args = array(
'hide_empty' => false,
'post_type' => 'company',
'post_status' => 'publish',
'orderby' => 'name',
'order' => 'asc',
) );
foreach($types as $type) {
$term_link = get_term_link( $type );
$image = get_field('company_profile', 'company_categories_' . $type->term_id . '' );
if ( has_term( $type->term_id, 'company_categories') ) {
echo '<a href="' . esc_url( $term_link ) . '">';
echo "<img src='" . $image['url'] . "' width='150'> ";
//break;
//unset($term);
}
}
?>
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.