How to display two identical fields of different post types inside detailed page (single.php)?

There is a basic essence of the post, inside it using ACF, you can add pictures (repeat of the files).
There is the essence of the photo albums, each post can attach a photo gallery (inside the same field - repeat of the files), more precisely to link by id.

Inside the detailed pages of the post, I get the gallery id attached further out.

The problem is that if I take a photo from the post and attached a photo from the gallery (from another entity) the magic happens - displays only the last
and when the first output from the first a warning is displayed:
Warning: Illegal offset type in isset or empty in acf

when updating the page the error disappears and these photos are no longer displayed in any case, even after detaching the second gallery.
The structure is the following:
1. The main loop WP
2. get_template_part('template', 'photo'); (photo attached to the post | code from the template below)
3. wp_reset_postdata();
4. Further, the external gallery:
$photogallery = new WP_Query(array(
 'p' => $photogallery_id,
 'post_type' => 'photo',
 while ($photogallery->have_posts()) : $photogallery->the_post();
 get_template_part('template', 'photo');

5. template-photo.php
<?if( have_rows('photogallery') ):?>
 <div id="fotoalbum" class="col-md-12 small-col">
 <div class="fotorama">
 while ( have_rows('photogallery') ) : the_row();
 $img = get_sub_field('photo');
 <img src="<?=$img['url'];?>">
April 3rd 20 at 18:45
1 answer
April 3rd 20 at 18:47
And, apparently you will help here is
Or, easier, do not make a separate file of the repeater, and to make all here and the code to register for if and while

if( have_rows('photogallery'), $photogallery_id )
Interesting, I will try - I will unsubscribe.
Thank you very much for the advice! - jermey19 commented on April 3rd 20 at 18:50

Find more questions by tags WordPress