WordPress 圣人模板无法循环出 acf 中继器字段


WordPress sage template can't loop out acf repeater field

由于某种未知原因,我无法在首页循环出中继器字段.php。我以圣人主题为基础。

这是我的基础.php的样子:

<?php
use Roots'Sage'Setup;
use Roots'Sage'Wrapper;
?>
<!doctype html>
<html <?php language_attributes(); ?>>
  <?php get_template_part('templates/head'); ?>
  <body <?php body_class(); ?> style="background-color: rgba(0,0,0,1);">
    <!--[if IE]>
      <div class="alert alert-warning">
        <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'sage'); ?>
      </div>
    <![endif]-->
        <?php include Wrapper'template_path(); ?>
    <?php
      do_action('get_footer');
      get_template_part('templates/footer');
      wp_footer();
    ?>
  </body>
</html>

这是我的首页.php的样子:

<div class="slider-circles">
  <?php if( have_rows('field_56e7d8bebb545') ): ?>
    <?php while ( have_rows('field_56e7d8bebb545') ) : the_row(); ?>
        <p id="slide1" data-bgimage="<?php the_sub_field('field_56e7d8cebb546'); ?>" class="transparent-circle slick-active"></p>
    <?php endwhile; ?>
  <?php endif; ?>
</div>

有趣的是,几天前我在另一个项目中做了完全相同的事情,一切都很好。我完全不知道为什么它现在不起作用:/

页上的默认wordpress循环.php适用于分配给"阅读>设置->帖子页面"的静态页面的帖子内容。

尝试使用

<?php die(var_dump(get_field('field_56e7d8bebb545'))); ?>

如果您没有看到中继器字段的任何值(并且 the_title() 之类的东西不起作用),则循环可能没有执行。

检查您是否已按照此处的说明将"首页显示"设置为"静态页面":https://codex.wordpress.org/Creating_a_Static_Front_Page