我可以在functions.php中的自定义函数中编写自定义字段数据。

问题描述:

I have my Flexile Content layout with custom fiels:

<h2 class="mb-half"><?php the_sub_field('form_two_title')?></h2>
<p class="mb-3 lead"><?php the_sub_field('form_two_text')?></p>

and I need to write them in my custom function of functions.php witch echo.

First of all, I need to find way how to call that layout, but is possible to write custom fields in echo section ??

I have something in that way:

echo '<h2 class="mb-half">.the_sub_field('form_two_title').</h2>';

but compiler do not recognize "form_two_title" constant..probably I need to call get_row_layout() ... any advices please?

The code you are calling is not a valid PHP:

echo '<h2 class="mb-half">.the_sub_field('form_two_title').</h2>';

Try fixing it like this:

echo '<h2 class="mb-half">'.get_sub_field('form_two_title').'</h2>';