Hi,
I was able to get a nested query working.
Here is my test repeater template.
<article>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_content(); ?>
<ul>
<?php
$args = array(
'post_type' => 'page',
'posts_per_page' => 3,
);
$test_query = new WP_Query( $args );
while ($test_query->have_posts()): $test_query->the_post();
global $post;
?>
<li class="no-img"><a href="<?php the_permalink(); ?>"><?php echo $post->ID; ?> - <?php the_title(); ?></a></li>
<?php endwhile; wp_reset_postdata(); ?>
</ul>
</article>
I believe your issue is that you need to pass a $post value to your custom field functions in order to return the correct data.
Notice the global $post;
in my template, and then the wp_reset_postdata()
.
https://gist.github.com/dcooney/357246e89c9e1b8ed4dc3bf395c07406
Can I ask why you just don’t create this query using the shortcode builder?