<?php /* (ステップ1)データの取得 */ $query = new WP_Query( array( 'post_type' => 'interview', 'posts_per_page' => -1, ) ); ?> <?php /* (ステップ2)データの表示 */ if ($query->have_posts()) : ?> <?php while ($query->have_posts()) : $query->the_post(); ?> <!-- 基本の取得 --> <p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p> <p><?php the_date(); ?></p> <p><?php the_category(", "); ?></p> <p><?php the_excerpt(); ?></p> <?php if (has_post_thumbnail()) : ?> <p><?php the_post_thumbnail(); ?></p> <?php endif; ?> <!-- カスタムポストの取得(ACFプロの繰り返し) --> <?php if (have_rows('interview_item')) : ?> <?php while (have_rows('interview_item')) : the_row(); ?> <div class="box-item"> <div class="item-content"> <p class="item-title"><?php the_sub_field('interview_title'); ?></p> <p class="item-name"> <span class="years"><?php the_sub_field('interview_years'); ?></span> <?php the_sub_field('interview_name'); ?> </p> <ul class="item-interview-list"> <?php if (have_rows('interview_qa')) : ?> <?php while (have_rows('interview_qa')) : the_row(); ?> <li> <p class="interview-q"><?php the_sub_field('interview_q'); ?></p> <p class="interview-a"><?php the_sub_field('interview_a'); ?></p> </li> <?php endwhile; ?> <?php endif; ?> </ul> </div> </div> <?php endwhile; ?> <?php endif; ?> <!-- //カスタムポストの取得(ACFプロの繰り返し) --> <?php endwhile; ?> <?php endif; wp_reset_postdata(); ?>