Quantcast
Channel: Clan VPS Host » loops
Viewing all articles
Browse latest Browse all 26

In WordPress loop, how do I check how many post have been looped through?

$
0
0

My goal is to print some extra html, after every four posts. What is wrong with the following code <?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. … Continue reading In WordPress loop, how do I check how many post have been looped through?

The post In WordPress loop, how do I check how many post have been looped through? appeared first on Clan VPS Host.


Viewing all articles
Browse latest Browse all 26

Trending Articles