Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress “存档”页面中的“高级自定义字段”子字段_Wordpress_Repeater_Advanced Custom Fields - Fatal编程技术网

Wordpress “存档”页面中的“高级自定义字段”子字段

Wordpress “存档”页面中的“高级自定义字段”子字段,wordpress,repeater,advanced-custom-fields,Wordpress,Repeater,Advanced Custom Fields,我在Wordpress中使用带有repeater插件的ACF插件,通常在archive.php中,我可以使用get_field或the_field函数,这些函数显示帖子的数据。(例如:头衔) 在single.php中,当我想使用archive.php中的子字段或获取子字段时,没有问题 在archive.php中,下面的示例没有显示任何单词。我怎样才能看到“是”这个词?我该怎么办?多谢各位 <?php if( have_rows('add_content') ):

我在Wordpress中使用带有repeater插件的ACF插件,通常在archive.php中,我可以使用
get_field
the_field
函数,这些函数显示帖子的数据。(例如:头衔)

在single.php中,当我想使用
archive.php中的
子字段
获取子字段
时,没有问题

archive.php
中,下面的示例没有显示任何单词。我怎样才能看到“是”这个词?我该怎么办?多谢各位

<?php
    if( have_rows('add_content') ):
        echo "Yes";
    else :
        echo "No";
    endif;
?>  

中继器需要一个if/while语句才能工作

 <?php if (have_rows('add_content')){ ?>
     <?php while (have_rows('add_content')) { the_row(); ?>
        Yes
     <?php } // while:   ?>
 <?php } else { ?>
       No
 <?php }  ?>

对
不

没有中继器。。。(如果没有添加内容,它会说不)。帖子有添加内容数据,但在归档页面中,我无法获取。谢谢你,Aibrean,但它在single.php中工作,在archive.php中不工作,我的意思是在分类页面中,它不会从任何帖子中获取转发器数据。例如,我有一个帖子,它有转发器字段。在分类页面中,我无法获取该帖子的转发器字段的数据。您是否将其放入该帖子的循环中?