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

  • Are you sure there is an image field called “icon” on each of your terms?
    Yes, there’s.

    What have you set as the return value of this field? With your current code it should be set to “image object”.
    Yes, it’s

    There’s attachment of my settings.

    Also, you’re currently echoing the image outside of the li tag which I don’t think is what you want.. ?
    I know. It should be like:

    $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 );
    	<?php foreach ($child_terms as $term) { ?>
    		$icon = get_field('icon', $term->taxonomy . '_' . $term->term_id);
    		$image_thumb = $icon['sizes']['full'];
            <h3><a href="<?php echo get_term_link( $term->name, $term->taxonomy ); ?>"><?php echo $term->name; ?></a></h3>
    		<img src="<?php echo $image_thumb; ?>" class="icona" alt="" />
    	<?php } ?>