I'm stuck with this loop issue. I've read many posts, asked ChatGPT, but I can't find out. My final goal is to display a flexible content within another flexible content with ACF Pro.
Here's my code :
<?php
if ( have_rows('content-text') ) :
while ( have_rows( 'content-text' ) ) : the_row();
$title_heading = get_sub_field('title-heading');
$title = get_sub_field('title');
$text = get_sub_field('text');
if ($title_heading == 'h2' ) {
echo '<h2 class="border-left">' . $title . '</h2>';
}
else {
echo '<h3 class="border-vertical">' . $title . '</h3>';
}
echo $text;
endwhile;
endif;
?>
On the front end, when $title_heading is equal to 'h2', it still displays this :
<h3 class="border-vertical"> </h3>
Where is the issue ?
Many thanks !
$title_heading
somewhere to see what it actually contains