Support

Account

Home Forums General Issues Query taxonomy for fields Reply To: Query taxonomy for fields

  • That’s because you fetch the image from the parent term.

    Here’s a snippet that should work better for you:

    
    <?php
    $current_term = get_queried_object();
    $args = array(
        'parent' => $current_term->term_id,
        'orderby' => 'slug',
        'hide_empty' => false
    );
    $child_terms = get_terms( $current_term->taxonomy, $args );
    ?>
    <ul>
    	<?php foreach ($child_terms as $term) { ?>
    		<?php
    		$icon = get_field('icon', $current_term->taxonomy . '_' . $current_term->term_id);
    		$image_thumb = $icon['sizes']['full'];
    		?>
    	    <li><h3><a href="<?php echo get_term_link( $term->name, $current_term->taxonomy ); ?>"><?php echo $term->name; ?></h3></a></li>
    		<img src="<?php echo $image_thumb; ?>" class="icon" alt="" />
    	<?php } ?>
    </ul>