I have the following code:
if(the_sub_field('company_name')) {
echo '<strong>Company name:</strong>';
echo '<p>' . the_sub_field('company_name') . '</p>';
}
When the page renders though, the company name renders (the_sub_field) but the Company name: does not.
This has also happened in a number of other places in my code when I echo some html out.
Is there a reason for this? Does it have to do with ACF? Many thanks
Solution:
if(get_sub_field('company_name')) {
echo '<strong>Company name:</strong>';
echo '<p>' . the_sub_field('company_name') . '</p>';
}