
I am trying to show image of taxonomy for custom post type, it is returning “h”
please help me to fix this
below is my code
<?php
$object = 'directory';
$output = 'objects';
$taxonomies = get_object_taxonomies( $object, $output );
$exclude = array('locations');
if ( $taxonomies ) {
foreach ( $taxonomies as $taxonomy ) {
if( in_array( $taxonomy->name, $exclude ) ) {
continue;
}
$terms = get_terms( array(
'taxonomy' => $taxonomy->name,
'hide_empty' => false,
) );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$term_image = get_field('image', 'category_' . $term->term_id);
$term_list .= '<div class="cat-col"><a href="' . esc_url( get_term_link( $term ) ) . '" ><figure><img src="' . $term_image['url'] . '"></figure>';
$term_list .= '<div class="cat-box"><div class="cat-box-top"><div class="icon"></div>';
$term_list .= '<h3>' . $term->name . '</h3></div>';
$term_list .= '<div class="cat-box-bottom"><span class="cat-count"><span>0 </span> <span>listings</span></span></div></div></a></div>';
}
echo $term_list;
}
}
}
?>
I have fixed the issue, i tried to changed the image format to array and it is fixed now.