I have created Advanced Content Type POD called 'product'. POD has relationship file field to upload images to a gallery: field name is "gallery". Products are related to each other within the same 'product' pod. I would like to show an image from relevant field on a front-end. So far i had no luck by putting following code into PODS template:
<?php$related = $obj->field( 'related_products' );
if ( ! empty( $related ) && is_array($related) ) {
foreach ( $related as $rel ) {
$id = $rel[ 'id' ];
$name = $rel[ 'name' ];
$permalink = $rel[ 'permalink' ];
$photos=$rel['gallery'];
if ( ! empty( $photos ) && is_array($photos) ) {
foreach ( $photos as $photo ) {
echo wp_get_attachment_image($photo['ID'], 'thumbnail');
} //end of foreach
}; //endif ! empty ( $photos )
echo '<a href="'.site_url( trailingslashit( 'products' ) . $rel[ 'permalink' ] ).'"><h4>' .$name.'</h4></a>';
} //end of foreach
} //endif ! empty ( $related )
?>