[英]ACF: load repeater field from a relationship field
我试图从具有高级自定义字段的相关帖子中加载转发器字段。
我有一个与谁有关系可以从另一个post_type加载帖子的帖子。 然后,此post_type具有Repeater_field。 我尝试加载相关文章的这些repeater_fields。 它是另一个对象内的一个对象。
这是我的代码:
<?php
$posts = get_field('related_posts'); // this is a relation field
if( $posts ):
foreach( $posts as $p ):
?>
<section class="slider">
<?php
$quotes = get_field('slider_quotes'); // this is my repeater field
if( have_rows($quotes) ):
while ( have_rows($quotes) ) : the_row();
?>
<div><h2><?php echo get_sub_field('quote'); ?></h2></div>
<?php endwhile; else:
echo "Nothing yet";
endif; ?>
</section>
我已经尝试过:
$frases = get_field('slider_quotes', $p->ID);
和
<?php echo get_sub_field('quotes', $p->ID); ?>
我什么也没有。
谢谢!
完整代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.