如何在 3 个 li 元素内循环 6 个帖子。我想告诉我的代码为每个 li 元素放置 2 篇文章。
<ul class="seminar-list">
<?php
$args = array(
'post_type' => 'topics',
'posts_per_page' => 6,
'tax_query' => array(
array(
'taxonomy' => 'topicscat',
)
)
);
$seminarQuery = new WP_Query($args);
$idx = 1;
if($seminarQuery->have_posts()): while($seminarQuery->have_posts()): $seminarQuery->the_post();
?>
<li>
<a href="topicscat/seminar-info/#event<?php echo $idx ?>">
<time><?php echo get_field('event-date') ?></time>
<span class="location"><?php echo get_field('location') ?>
</span>
</a>
</li>
<?php $idx++; endwhile; wp_reset_postdata(); endif; ?>
</ul>
qq_花开花谢_0