Php Wordpress中的ACF中继器不显示图像

Php Wordpress中的ACF中继器不显示图像,php,wordpress,custom-post-type,advanced-custom-fields,Php,Wordpress,Custom Post Type,Advanced Custom Fields,我无法在Wordpress中使用转发器显示图像。 出于某种原因,它只显示alt文本而不是图像本身? 上面的图片是我的缩略图,显示正确。 有人知道这是什么原因吗 我的代码 <div class="row"> <div class="col-sm-6 left"><h1>COMMERCIAL</h1><br> <div class="page-header"> <?php $

我无法在Wordpress中使用转发器显示图像。 出于某种原因,它只显示alt文本而不是图像本身?

上面的图片是我的缩略图,显示正确。 有人知道这是什么原因吗

我的代码

   <div class="row">
    <div class="col-sm-6 left"><h1>COMMERCIAL</h1><br>
       <div class="page-header">

        <?php $mymovies = new WP_Query(array(
          'post_type' => 'my_movies'
          )); ?>

          <?php while($mymovies->have_posts()) : $mymovies->the_post(); ?>
            <div class="movie-colums">
             <div class="thumbtitle group">
                <div class="preview">
                   <?php the_post_thumbnail('thumbnail'); ?>
                   <h1><?php the_title(); ?><br>
                      <?php the_field('year'); ?>   
                      <?php
                      // check if the repeater field has rows of data
                      if( have_rows('images_rep') ):
                        // loop through the rows of data
                        while ( have_rows('images_rep') ) : the_row();
                    // display a sub field value
                    the_sub_field('image');
                    endwhile;
                    else :
                       // no rows found
                        endif;
                    ?>                                  
                </h1>
            </div>

        </div>
    </div>
 <?php endwhile; ?>
</div>

商业


提前感谢

您对repeater内容的PHP位应该是:

<?php if( have_rows('images_rep') ): ?>

    <?php while( have_rows('images_rep') ): the_row(); 
        $image = get_sub_field('image');
    ?>

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

    <?php endwhile; ?>

<?php endif; ?>

“alt=”“>
看起来您的示例正在输出图像对象,所以只需将图像URL包装在图像标记中


Ref:

@AlfredKwak现在检查一下。我做了一些编辑。也用全新的代码更新了你的第一篇文章。查看我的新更新。用我所做的完全替换你的重复循环。你包括了整个图像对象,而不仅仅是URL。哈,对不起!我的错误!它现在正在工作!:)谢谢你的时间和努力!非常感谢你的welcome@AlfredKwak请投票并将此答案标记为正确:)