I'm trying to obtain values from an ACF group
but unable to obtain them through two approaches:
Here is how my ACF fields
are set up for reference:
Approach 1:
<?php
$welcome_screen_content = get_field('welcome_screen_content'); // type: group
if( $welcome_screen_content ):
$title = get_field('title');
endif;
echo $title; // prints nothing
?>
Approach 2:
<?php
if( have_rows('welcome_screen_content') ):
while( have_rows('welcome_screen_content') ): the_row();
$title = get_sub_field('title');
echo $title; // prints nothing
endwhile;
endif;
?>
On my post template, title
does have a value:
So unsure why in both attempts, echoing $title
does nothing?