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

报告相同问题?

悬赏问题

  • ¥15 用Multisim设计汽车尾灯控制电路
  • ¥15 关于#java#的问题,请各位专家解答!(开发工具-eclipse)
  • ¥100 求用matlab求解上述微分方程的程序代码
  • ¥15 MAC安装佳能LBP2900驱动的网盘提取码
  • ¥400 微信停车小程序谁懂的来
  • ¥15 ATAC测序到底用什么peak文件做Diffbind差异分析
  • ¥15 安装ubantu过程中第一个vfat 文件挂载失败
  • ¥20 GZ::CTF如何兼容一些靶机?
  • ¥15 etcd集群部署问题
  • ¥20 谁可以帮我一下问一下各位