the_field()
is an ACF function and will echo
content. It follows the WordPress (somewhat) pattern whereby functions with the_
at the front will echo
content and functions beginning with get_
return content.
Displays the value of the specified field. (this is the same as “echo
get_field($field_name)”)http://www.advancedcustomfields.com/resources/functions/the_field/
Using the wrong function, as you have, will cause data to output in the wrong location. Use get_the_field()
instead.