Support

Account

Home Forums Front-end Issues Page link – get page title, copy and image Reply To: Page link – get page title, copy and image

  • I have been able to get the page title but can’t get the custom field inside of it….

    <?php if( have_rows('page_selector') ):
    $i=1;
    $count = (count($my_fields['value']));
    ?>          
    <?php while( have_rows('page_selector') ): the_row(); 
        // vars
        $page = get_sub_field('page');
    ?>  
    	<div class="lg-col-6 md-col-6">
    		<div class="sub_service">
    
    			<?php 
    			// vars
    			$post_id = get_sub_field('page', false, false);
    
    			// check 
    			if( $post_id ): ?>
    			<a href="<?php echo get_the_permalink($post_id); ?>"><h2><?php echo get_the_title($post_id); ?></h2></a>
    
    			<?php endif; ?>
    
    			
    			<p>Content</p>
    			
    		</div>
    	</div>			        		
    <?php
        $i++;
        endwhile; ?>
    <?php endif; ?> 
    <?php wp_reset_query(); ?>