Support

Account

Home Forums General Issues Preprend / Append Text Around Variable, Out of Order

Solving

Preprend / Append Text Around Variable, Out of Order

  • Hi,

    When I try and format some text as so…

    INFRONT TEXT + VARIABLE + BEHIND TEXT

    It outputs as follows…

    VARIABLEINFRONTBEHIND

    When using the following code…

    $client_list = get_field('client');
    
                if( $client_list ){
                  foreach( $client_list as $client_list_item ){
                    echo 'INFRONT TEXT'.the_field('name', $client_list_item).' BEHIND TEXT';
                  }
                }

    Do you have any pointers as to this behaviour?

    Thanks,
    Andy.

  • OK, I found out what I was doing wrong. I was using the_field, when I should have been using ‘get_field’. Thanks.

  • Glad you got it worked out

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Preprend / Append Text Around Variable, Out of Order’ is closed to new replies.