Home › Forums › General Issues › Relationship Field on single-cpt.php › Reply To: Relationship Field on single-cpt.php
Hi @seasterling
You should be able to check if the current product loop is the same as the current product page like this:
// Get the current product page ID
$current_product_id = get_the_ID();
foreach( $products as $product ):
// Skip if the current product is listed
if( $current_product_id == $product->ID ){
continue;
}
$relatedImages = get_field('images', $product->ID);
// Rest of the code here
endforeach;
I hope this helps 🙂
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.