I’m trying to get this working following the documentation but it still doesn’t work. Ay suggestions?
if (get_field('departures', get_the_ID())) {
while( have_rows('departures') ): the_row();
// NOT WORKING
echo the_sub_field('departure_date');
// WORKING
$a = the_row();
echo $a['departure_date'];
endwhile;
}
Example data:
[{"departure_date":"01-12-2020"]}[{"departure_date":"07-12-2020"]}
do not use echo when using the_… functions
instead of echo the_sub_field('departure_date');
use the_sub_field('departure_date');