Skip to content

Instantly share code, notes, and snippets.

@barbwiredmedia
Last active July 27, 2020 23:14
Show Gist options
  • Save barbwiredmedia/8428881 to your computer and use it in GitHub Desktop.
Save barbwiredmedia/8428881 to your computer and use it in GitHub Desktop.
Wordpress acf relationship field
<?php
$testimonial_check = get_field('your_relationship_field_name');
if ($testimonial_check) {
?>
<?php foreach (get_field('your_relationship_field_name') as $relationship): ?>
<p>"<?php echo get_post_meta($relationship->ID, 'some_field_content', true); ?>"</p>
<small><?php echo get_the_title($relationship->ID); ?> | <?php echo get_post_meta($relationship->ID, 'some_more_field_content', true); ?> </small>
<?php endforeach; ?>
<?php } ?>
<?php //var_dump( get_field('relationship') );?>
<?php
$posts = get_field('success_story_selector');
if( $posts ): ?>
<?php foreach( $posts as $post): ?>
<?php setup_postdata($post); ?>
<?php the_field('story_information') ;?>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment