你可以在这样的两篇文章之后每隔一段时间添加一个div。
<?php $count = 1; // add this before loop ?>
<?php
// add this inside the loop
if ($count % 3 == 0) :
echo \'YOUR IMAGE DIV HERE\';
endif; $count++; ?>
所以,会是这样的。
<?php $args = array( \'post_type\' => \'galleries\');
$queryone = new WP_Query( $args );
$count = 1;
while ($queryone -> have_posts()) : $queryone -> the_post(); ?>
<?php if ($count % 3 == 0) :
echo \'YOUR IMAGE DIV HERE\';
endif; $count++; ?>
<section class="feature-third">
<a href="<?php echo get_permalink( $ID ); ?>" title="<?php the_title( ); ?>">
<div class="feature-captions"><?php $current_cat_id = the_category_ID(false); echo \'<p class="category-link">\' . get_cat_name($current_cat_id) . \'</p>\'; ?><h2><?php echo get_the_title( $post->ID ); ?> </h2><?php if( get_field(\'subtitle\') ): ?><p><?php the_field(\'subtitle\'); ?></p><?php endif; ?></div>
<?php the_post_thumbnail(\'full\'); ?>
</a>
</section>
<?php endwhile; ?>