Hi
i use a repeater field (dates) with 3 fields.
for the field ‘location’ is linked with taxonomy ‘locations’, i can’t get his name but just the ID. Anyone has an idea please ?
thanks a lot
<?php if( have_rows('dates') ): ?>
<?php while( have_rows('dates') ): the_row();
// vars
the_sub_field('date_event');
the_sub_field('hours');
$variable = get_sub_field( 'location' );
echo $variable;
?>
<?php endwhile; ?>
<?php endif; ?>
this is what i got :
Array ( [0] => Array ( [date_event] => 05/02/2015 [location] => 12 [hours] => 20h ) )
How can i convert location id (12) to his name please ???
thanks
Hi @pipoulito,
Thanks for the post.
You will need to ensure that you have set the return type to term object and then have the following code to display the term name:
<?php
$term = get_sub_field('location');
if( $term ): ?>
<h2><?php echo $term->name; ?></h2>
<?php endif; ?>