Home › Forums › General Issues › List Custom Taxonomy with Custom Fields › Reply To: List Custom Taxonomy with Custom Fields
Thi is how I solved it:
<div class="dest-box">
<div class="rk-row">
<?php
$counter=1;
$terms = get_terms( 'region' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<div">';
foreach ( $terms as $term ) {
if ($term->parent > 0) { continue; }
$term_link = get_term_link( $term );
$image = get_field('region_image', $term->taxonomy . '_' . $term->term_id);
$size = 'homepage-thumb';
$thumb = $image['sizes'][ $size ];
$width = $image['sizes'][ $size . '-width' ];
$height = $image['sizes'][ $size . '-height' ];
echo '<div class="col-md-6">';
echo '<div class="destination-loop">';
echo '<img src="' . $thumb . '"/>';
echo '<h3><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></h3>';
echo '<p>' . $term->description . '</p>';
echo '</div></div>';
if ($counter == 2) {
echo '<div class="clearfix"></div></div><div class="rk-row">';
$counter=0;
}
$counter++;
}
}
?>
<div class="clearfix">
</div></div>
</div>
Thanks very much mate !
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.