Hi guys. I have issues with true way to show the name of a Custom Taxonomy.
Let me explain my situation: I created a “Repeater field” and inside it I have a “Taxonomy sub field”, in this sub field I have selected my custom taxonomy “dato_nutricional” the Field type as Select and the Return Value as ID term. I was using the fallowing code to try to show the taxonomy name:
<span><?php
$sntermino = get_sub_field('sula_nutricional_termino');
if( $sntermino ): echo $sntermino->name; endif; ?>
?></span>
But I wasn’t has lucky with this. If I only use echo $sntermino
with out ->name I have the ID of my taxonomy as value
Please, can you help me with this issue?
Hi Guys. Finally I found the solution!!!!
I leave for you the solution that I found:
<?php
if( have_rows('repeater_field_name') ):
while( have_rows('repeater_field_name') ): the_row();
$tax_val = get_sub_field('taxonomy_sub_field_name');
$taxonomy = 'custom_taxonomy_name';
$term_name = get_term($tax_val, $taxonomy);
if( $tax_val ): echo $term_name->name;
endif;
endwhile;
endif;
?>