【发布时间】:2015-02-09 00:56:32
【问题描述】:
您好,由于自定义插件,我在显示 ACF 字段时遇到了问题。 然后我发现我可以改写:
<?php $outputtext= get_field('text'); ?>
<?php echo $outputtext; ?>
而不是
<?php get_field('text'); ?>
因为激活插件时这不起作用。
所以我一直在寻找答案一段时间,并且一直在测试我确实获得字段以显示转发器的相同方式。没有成功...
是的,我一直在测试常规代码
<?php
// check if the repeater field has rows of data
if( have_rows('topp_yrken_referenser') ):
// loop through the rows of data
while ( have_rows('topp_yrken_referenser') ) : the_row(); { ?>
<div class="col-xs-12 col-sm-4">
<blockquote>
<?php // display a sub field value
the_sub_field('topp_yrke_referens');
?>
</blockquote>
</div>
<?php } endwhile;
else :
// no rows found
endif;
?>
这是它在自定义插件停止工作之前的工作方式
-
我怎样才能像我用这个来做这样的工作?
这个 $this= get_field('text'); 有名称吗? ?
【问题讨论】:
-
没有 else/endif 是否可以工作?
-
没有其他的几乎是一样的。没有 endif 我得到空站点,没有 else 和 endif 我得到空页面...
标签: php wordpress repeater advanced-custom-fields