Support

Account

Home Forums Front-end Issues PHP echo stripping formatting in Advanced Custom Fields

Solved

PHP echo stripping formatting in Advanced Custom Fields

  • 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>';
    															 			}
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘PHP echo stripping formatting in Advanced Custom Fields’ is closed to new replies.