ACF (Wordpress) the_field不起作用


ACF (Wordpress) the_field doesn't work

我的代码:

 <p><?php the_field('myimage'); ?></p>

token from: http://www.advancedcustomfields.com/resources/code-examples/

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

如果是图像,则需要<img>标签:

<img src="<?php the_field('myimage'); ?>" />

使用get_field获取自定义字段值。它返回值数组。使用以下代码获取图像url:

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