【问题标题】:add 1 to field name with perimeters at end Advanced custom fields WordPress将 1 添加到字段名称并在末尾加上周长高级自定义字段 WordPress
【发布时间】:2019-12-18 23:37:29
【问题描述】:

我在 WordPress 中使用高级自定义字段并尝试在字段名称的末尾添加一个整数并增加一个整数,这很好用,直到我添加一个周长然后它不起作用。

例如

有效

 <h3 style="min-height: 150px">test<?php the_field_1('text_', false, false) ?></h3>

有效

 <h3 style="min-height: 150px">test<?php the_field('text_' . ($i+1))?></h3>

不工作(但需要工作)

<h3 style="min-height: 150px">test<?php the_field('text_' . ($i+1)), false, false) ?></h3>

有谁知道如何解决这个问题,或者是否有适当的方法来处理周边?

【问题讨论】:

    标签: php html wordpress loops


    【解决方案1】:
    <h3 style="min-height: 150px">test<?php the_field('text_' . ($i+1)), false, false) ?></h3>
    // to many brackets the error is here, remove this one            ^
    

    其实为了简化你可以使用

    <h3 style="min-height: 150px">test<?php the_field('text_' . $i+1, false, false) ?></h3>
    

    因为括号几乎没有或什么也没有

    【讨论】:

      猜你喜欢
      • 2018-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-25
      • 2012-08-10
      相关资源
      最近更新 更多