douang2297 2018-09-24 17:57
浏览 92
已采纳

我可以在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?

  • 写回答

1条回答 默认 最新

  • dpxo13079 2018-09-24 18:03
    关注

    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>';
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?