Hi !
I’ve set ACF img field to all my categories,
I’ve custom category template page that display child categories of it’s parent but I can’t display my images…
If someone can help.
Thanks
<?php $term_children = get_terms(
array(
'taxonomy' => 'category',
'parent' => get_queried_object_id(),
)
);
if ( ! is_wp_error( $term_children ) ){
foreach ( $term_children as $child ) {
the_field('cat_img', $child->term_id);
}
}
?>
It works !
I had to set category_{id} as second parameter of the_field().
but to be honest I don’t understand why, the documentation says nothing about this, so if someone can turn on the light…
the documentation :
th_field($selector, [$post_id], [$format_value]);
the_field('cat_img', 'category_'.$child->term_id);