Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.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 ACF中继器未在列表中显示第一个_Wordpress_Advanced Custom Fields - Fatal编程技术网

Wordpress ACF中继器未在列表中显示第一个

Wordpress ACF中继器未在列表中显示第一个,wordpress,advanced-custom-fields,Wordpress,Advanced Custom Fields,在前端显示“我的中继器”字段时,它将显示该列表中除第一项之外的所有内容。我希望它能显示转发器中的所有内容 <?php if( have_rows('the_list') ): the_row(); ?> <div class="row"> <?php while( have_rows('the_list') ): the_row(); ?> <div class="col-md-8"> <h6&

在前端显示“我的中继器”字段时,它将显示该列表中除第一项之外的所有内容。我希望它能显示转发器中的所有内容

<?php if( have_rows('the_list') ): the_row(); ?>
<div class="row">
    <?php while( have_rows('the_list') ): the_row(); ?>
        <div class="col-md-8">
            <h6><?php the_sub_field('name') ?></h6>
            <p><?php the_sub_field('number') ?></p>
        </div>
    <?php endwhile; ?>
</div>
<?php endif; ?>


您正在运行
行()两次。从if语句后删除此项可以解决问题

以下是更新的代码段:

<?php if( have_rows('the_list') ): ?>
    <div class="row">
        <?php while( have_rows('the_list') ): the_row(); ?>
            <div class="col-md-8">
                <h6><?php the_sub_field('name') ?></h6>
                <p><?php the_sub_field('number') ?></p>
            </div>
        <?php endwhile; ?>
    </div>
<?php endif; ?>



请发布您的代码,以便我们提供帮助。@mbacon40我已经添加了用于提取此代码的代码段。您能检查后端的第一行是否为空吗?
<?php global $post; ?>
<?php if( have_rows('the_list'), $post->ID ): ?>
 <div class="row">
  <?php while( have_rows('the_list'), $post->ID ): the_row(); ?>
   <div class="col-md-8">
    <h6><?php the_sub_field('name') ?></h6>
    <p><?php the_sub_field('number') ?></p>
   </div>
  <?php endwhile; ?>
 </div>
<?php endif; ?>