【发布时间】:2017-04-07 03:30:54
【问题描述】:
我的目标是在每四篇文章之后打印一些额外的 html。
下面的代码有什么问题
<?php while ( have_posts() ) : the_post(); ?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php
$posts = $wp_query->post_count;
if ( $posts == 4 ) {
echo '<div class="clearfix"></div>';
}
?>
<?php endwhile; // end of the loop. ?>
【问题讨论】: