Support

Account

Home Forums Add-ons Repeater Field Display repeater fields in child pages Reply To: Display repeater fields in child pages

  • Hi @sasori390,

    I think this should just about do it.. this can be used outside of the loop which I assume you are doing. If not you could probably remove the global $post.

    
    <?php
    global $post;
    if($post->post_parent){
    	$postid = $post->post_parent;
    }else{
    	$postid = $post->ID;
    }
    ?>
    
    <?php if(get_field('content-container', $postid)): ?>
    <ul>
    	<?php while(has_sub_field('content-container', $postid)): ?>
    	<li><a href="<?php the_permalink() ?>#<?php the_sub_field('anchor'); ?>"><?php the_sub_field('header'); ?></a></li>
    	<?php endwhile; ?>
    </ul>
    <?php endif; ?>