Hello I am using advanced custom fields and I am trying to pull data from multiple pages and display it on another
I set up a relationship field called "data", and then on page X where the relationship field is displayed I have chosen page Y where I want to pull the data from
<?php if( get_field('data') ): ?> <?php the_field('special_offer'); ?> <!--// get content from page Y --> <?php endif; ?>
I can't get this to work though and Im presuming the above is wrong, does anyone know how I could do this please?
Hopefully I have explained it clearly
<?php if( $related_pages = get_field( 'special_offer_relationship' ) ): ?> <?php foreach( $related_pages as $page ): ?> <?php echo get_the_title( $page->ID ); ?> <?php echo get_the_excerpt( $page->ID ); ?> <?php endforeach; ?> <?php endif; ?>