Hi,
I have this repeater field called “news” and its subfield is also called “news.” The thing is that I have three subfields but only the last field shows up.
I have this code;
<?php
if( get_field('news') )
{
while( has_sub_field('news') )
{
$news = get_sub_field('news');
}
}
?>
<?php echo $news; ?>
<?php endwhile; endif; ?>
Thanks!
By having just $news = get_sub_field('news');
every time your while loop loops through the array, you’re overwriting the $news variable, if you do $news .= get_sub_field('news');
you’ll be appending to it instead.
Sorry if that doesn’t make much sense, I am apparently rotten at explaining things. <.<
Hm, one problem is that, the rows appear all in one line, i.e., there’re no line breaks. Could you help me with it please?