Relationship ACF snippet - Brown Surfing

Relationship ACF snippet

Posted on: August 17th, 2022
By: Efrain Lemus

$featured_posts = get_field('page_links');

if( $featured_posts ):
foreach( $featured_posts as $post ): 
// Setup this post for WP functions (variable must be named $post).
setup_postdata($post);
echo '<h6><a href="' . get_the_permalink() . '">' . get_the_title() . '</a></h6>';
echo '<hr class="mt-2">';
endforeach;
    // Reset the global post object so that the rest of the page works correctly.
    wp_reset_postdata(); 
endif;

Have any questions or comments? Write them below!


Leave a Reply

Your email address will not be published.