Support

Account

Forum Replies Created

  • Now it works like a charm. Thanks so much for your help.

  • 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(); ?>
    
  • Thanks Jonathan for your response.
    Just tried your code and I got the list displayed just the way I want. The only problem is the <?php the_permalink() ?> displays the current url, not the parent url. Any clue?

Viewing 3 posts - 1 through 3 (of 3 total)