ACF(Wordpress)the_field不起作用

时间:2015-09-26 03:15:47

标签: php wordpress advanced-custom-fields

我的代码:

 <p><?php the_field('myimage'); ?></p>
来自:http://www.advancedcustomfields.com/resources/code-examples/

令牌

它什么也没显示。为什么呢?

2 个答案:

答案 0 :(得分:0)

如果是图片,则需要redirect_to标记:

<img>

答案 1 :(得分:0)

使用get_field获取自定义字段值。它返回值数组。要获取图像网址,请使用以下代码。

   <?php $image = get_field('myimage'); ?>

   <img src="<?php $image['url']; ?>" />