Support

Account

Home Forums Front-end Issues Displaying and linking to the post chosen within Flexible Content layout field Reply To: Displaying and linking to the post chosen within Flexible Content layout field

  • No problem @jantye ! Now you know 🙂

    I think I understand what your code is supposed to do and you have quite a bit of unnecessary code going on. Here’s a cleaned up version which should also have working links. I have of course not tested the code so there might be errors but hopefully it’ll work right out of the bat!

    
    <?php if(get_row_layout() == "two_eq_columns"): ?>
    	 
    	<div class="two-eq-cols">
    	
    		<?php $page_object = get_sub_field('left_50-50_column'); ?>
    		<a href="<?php echo get_permalink($page_object->ID); ?>">
    			<?php the_sub_field('two_eq_columns'); ?>
    			<h2><?php echo $page_object->post_title; ?></h2>
    		</a>
    		<?php echo $page_object->post_excerpt; ?>		
    
    	 </div>
    
    	<div class="two-eq-cols">
    	
    		<?php $second_page_object = get_sub_field('right_50-50_column'); ?>
    		<a href="<?php echo get_permalink($second_page_object->ID); ?>">
    			<?php the_sub_field('two_eq_columns'); ?>
    			<h2><?php echo $second_page_object->post_title; ?></h2>
    		</a>
    		<?php echo $second_page_object->post_excerpt; ?></div>
    		<div class="clearit"></div>
    		
    	</div>
    
    <?php endif; ?>