同一文件中的 Advance Custom Field Multiple Get Field Code 不起作用

Advance Custom Field Multiple Get Field Code in the same file not working

我正在使用 Advance Custom Field 插件将自定义字段添加到我的一个自定义 post 类型的插件中。我有这段代码,我使用了 get_field() 两次。我遇到的问题是其中只有一个有效——我为该自定义 post 类型创建的第一个。 第二个只有在我从代码中删除第一个时才有效。请看下面的代码。

示例:

<div class="ats-awsm awsm-grid-modal awsm-grid">
        <?php while ($team->have_posts()): $team->the_post();
            $teamdata = $this->get_options('awsm_team_member', $team->post->ID);?>
                <div id="" class="awsm-grid-card">
                    <div class="author_avatar">
                        <a href="#" id="tigger-style-<?php echo $id.'-'.$team->post->ID; ?>" class="awsm-modal-trigger" data-trigger="#modal-style-<?php echo $id.'-'.$team->post->ID; ?>">
                            <img src="<?php echo $this->team_thumbnail($team->post->ID);?>" alt="<?php the_title();?>">
                            <?php $this->checkprint('<span>%s</span>', $teamdata['awsm-team-designation']);?>
                        </a>
                    </div>
                    <div class="awsm-personal-info-container">
                        <div class="awsm-personal-info">
                            <a href="#" id="tigger-style-<?php echo $id.'-'.$team->post->ID; ?>" class="awsm-modal-trigger" data-trigger="#modal-style-<?php echo $id.'-'.$team->post->ID; ?>">
                                <h3><?php the_title(); ?></h3>
                                <span><?php _e( 'Click for Quick Profile', '' ) ?></span>
                            </a>
                        </div>
                        <div class="shortdesc"><?php $this->checkprint('<p>%s</p>', $teamdata['awsm-team-short-desc']);?></div>
                        <div class="authorsarticles">
                            <h4><?php _e( 'Articles', '' ) ?></h4>
                            <?php the_field('userpost_shortcode'); ?>
                            <a href="<?php echo esc_url( home_url( '/author' ) ); ?>" class="more_btn"><?php _e( 'More from this writer', '' ) ?></a>
                            <div><?php the_field('contributors_page'); ?></div>
                        </div>
                    </div>  
                </div>
            <?php endwhile; wp_reset_postdata();?>
        </div><!-- .grid -->

后端一切正常,但我不确定为什么会这样。

尝试将 $team->post->ID 添加到 the_field() 函数。所以它看起来像:the_field('userpost_shortcode', $team->post->ID)