2 queries with counters
I have 2 loops on a page both containing a counter to implement slightly different code every 6 posts. For some reason though the second loop is implementing the different code sometimes after 4 items instead of 6.
Am I not resetting the loop correctly?
ul class="tabs"
li class="tab-link current" data-tab="tab-1"Most Popular/li
li class="tab-link" data-tab="tab-2"Recent/li
/ul
div id="tab-1" class="tab-content current"
div class="slider"
div class="slide"
?php
query_posts('meta_key=post_views_countorderby=meta_value_numorder=DESCpost_type=atls_videoposts_per_page=-1');
if (have_posts()) : while (have_posts()) : the_post();$count++; ?
?php if ($count%6== 0) : ?
div class="video-entry m-all t-1of2 d-1of3 cf"
div class="video-thumb"
a href="?php the_permalink(); ?"?php the_post_thumbnail( 'video-thumb' ); ?/a
/div
div class="video-text"
a href="?php the_permalink(); ?" class="title"?php the_title(); ?/a
a href="?php the_permalink(); ?" class="read-more"Read More/a
/div
/div
/div
div class="slide"
?php else : ?
div class="video-entry m-all t-1of2 d-1of3 cf"
div class="video-thumb"
a href="?php the_permalink(); ?"?php the_post_thumbnail( 'video-thumb' ); ?/a
/div
div class="video-text"
a href="?php the_permalink(); ?" class="title"?php the_title(); ?/a
a href="?php the_permalink(); ?" class="read-more"Read More/a
/div
/div
?php endif; ?
?php endwhile; endif; wp_reset_query();?
/div
div style="clear:both;"/div
/div
/div
div id="tab-2" class="tab-content"
div class="slider"
div class="slide"
?php
query_posts('orderby=dateorder=DESCpost_type=atls_videoposts_per_page=-1');
if (have_posts()) : while (have_posts()) : the_post();$count++; ?
?php if ($count%6== 0) : ?
div class="video-entry m-all t-1of2 d-1of3 cf"
div class="video-thumb"
a href="?php the_permalink(); ?"?php the_post_thumbnail( 'video-thumb' ); ?/a
/div
div class="video-text"
a href="?php the_permalink(); ?" class="title"?php the_title(); ?/a
a href="?php the_permalink(); ?" class="read-more"Read More/a
/div
/div
/div
div class="slide"
?php else : ?
div class="video-entry m-all t-1of2 d-1of3 cf"
div class="video-thumb"
a href="?php the_permalink(); ?"?php the_post_thumbnail( 'video-thumb' ); ?/a
/div
div class="video-text"
a href="?php the_permalink(); ?" class="title"?php the_title(); ?/a
a href="?php the_permalink(); ?" class="read-more"Read More/a
/div
/div
?php endif; ?
?php endwhile; endif; wp_reset_postdata();?
/div
div style="clear:both;"/div
/div
/div
Topic wp-reset-query loop count wp-query query-posts Wordpress
Category Web