Я пытаюсь создать «связанный» модуль с Wordpress и Расширенные настраиваемые поля (ACF).
У меня есть следующий цикл:
<?php
// Settings
$categories = get_the_category();
if ( count($categories) < 2 ) {
$cat = $categories[0]->cat_ID;
} else {
$cat = $categories[1]->cat_ID;
}
$query = new WP_Query('cat='. $cat);
?>
<section class="related">
<?php // The loop
if ($query->have_posts()):
while ($query->have_posts()) : $query->the_post();
// The content part
if (have_rows('content')):
while (have_rows('content')) : the_row();
// Only print cover
if (get_row_layout() === 'cover'):
// Cover content...
endif;
// End: The content part
endwhile;
endif;
// End: The loop
endwhile;
// Reset loop, keep Wordpress from looping through unwanted modules
wp_reset_postdata();
endif;
?>
</section>
Я хочу, чтобы цикл печатал только модуль обложки, вместо этого он печатал все поля внутри content-модуля, который является гибким полем содержимого. . Я наблюдаю за чем-то, что заставляет его зацикливать другие модули, кроме cover?