Support

Account

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

  • Hi Jonathan, I still cannot get this working for some reason. the_permalink($postid); still displays the current page url instead of the parent.
    Sorry I’m no php expert, I’d appreciate if you could tell me what’s wrong. Here is the entire code of the actual template.

    
    <?php
    /*
    Template Name: Page CEO Massage
    */
    ?>
    
    <?php get_header(); ?>
    
    	<section id="slider">
    		<div id="page-title-container">
    			<h1 id="page-title"><?php
    				echo empty( $post->post_parent ) ? get_the_title( $post->ID ) : get_the_title( $post->post_parent );
    			?></h1>
    		</div>
    	</section>
    	<section id="content">
    		<div id="col-lt">
    		
    		<?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($postid); ?>#<?php echo preg_replace('/[^A-Za-z0-9]/', "", get_sub_field('header')); ?>"><?php the_sub_field('header'); ?></a></li>
    			<?php endwhile; ?>
    		</ul>
    		<?php endif; ?>
    		
    		</div>			
    		<div id="col-rt" class="top_no_padding">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    			<h2><?php the_title(); ?></h2>
    			<p><?php the_field('ceo_message'); ?></p>
    		<?php endwhile; endif; ?>
    		</div>
    	</section>
    
    <?php get_footer(); ?>