Support

Account

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

  • Got it working!
    There’s no need to use this $image_thumb = $icon['sizes']['full'];
    Just echo $icon and Return Value should be Image URL nor Image Object.
    Thanks again Jonathan for help.

    
    <?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', $term->taxonomy . '_' . $term->term_id);
    		?>
    	    <li>
            <h3><a href="<?php echo get_term_link( $term->name, $term->taxonomy ); ?>"><?php echo $term->name; ?></a></h3>
    		<img src="<?php echo $icon; ?>" class="icona" alt="" />
            </li>
    	<?php } ?>
    </ul>