У меня есть поле отношения, которое передает сообщение / контент в гибкое поле контента.Теперь у меня есть блок-повторитель, и при запуске будет возвращаться только одна строка, даже когда я добавляю больше.Куда я иду не так?
<?php
global $post; // Querying outside the loop
$cta_block_item = get_sub_field( 'relationship_field', $post->ID );
if ( $cta_block_item ):
foreach ( $posts as $post ):
setup_postdata ( $post );
if (have_rows('page_builder')): // Get the rows of the Flexible content field of my target
while (have_rows('page_builder', $post->ID)):
the_row();
if (get_row_layout() == 'cta_grid') {
$cta_grid_select = get_sub_field('cta_grid_select'); // get the custom field I want to get
if ( have_rows( 'row') ) :
while ( have_rows( 'row', $post->ID ) ) : the_row();
if ( $cta_grid_select ):
foreach ( $cta_grid_select as $post ):
setup_postdata ( $post );
// Expected: I should see all rows of my repeaters content
// Current Result: Returns only one row from the repeater
endforeach;
wp_reset_postdata();
endif;
endwhile;
else :
// no rows found
endif;
}
endwhile;
else:
// no layouts found
endif;
endforeach;
wp_reset_postdata();
endif;
?>
Ожидается: я должен видеть все строки содержимого моих репитеров
Фактический результат: возвращает только один ряд из репитера