Home › Forums › General Issues › Relationship Field on single-cpt.php › Reply To: Relationship Field on single-cpt.php
This works. Now just need to eliminate the current product from the list.
$relatedImages = get_field('images', $product->ID);
$size = 'related-product-thumbnail';
$relatedThumb = $relatedImages['sizes'][ $size ];
?>
<li>
<a href="<?php echo get_permalink( $product->ID ); ?>" title="<?php echo get_the_title( $product->ID ); ?>">
<span><img src="<?php echo $relatedThumb ?>"></span>
<span class="related-product-title"><?php echo get_the_title( $product->ID ); ?></span></a>
</li>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.