I got the total number of entries and made a loop. Inside the cycle there are two cycles. The first loop displays the table. The second loop displays the list.
<section> <div class="container container-gallery"> <?php $offset = 0; $offset1 = 0; $i =0; $count = 0; $reset =0; $reset1 = 0; $args = array( 'posts_per_page' => -1, 'post_type' => 'gallery', ); $gallery = new WP_Query( $args ); $numberposts = $gallery->post_count; if ($numberposts){ $id1=0; $id2=0; while($count < $numberposts){ // print_r($arr1); $count++; //echo "<h2>".$count."</h2>"; $arr1 = array( 'posts_per_page' => 400, 'post_type' => 'gallery', 'offset'=>$offset ); $arr2 = array( 'posts_per_page' => 400, 'post_type' => 'gallery', 'offset'=>$offset1 ); $loop1 = new WP_Query($arr1); $loop2 = new WP_Query($arr1); while($loop1->have_posts()) : $loop1->the_post(); if ($reset<3) : $reset++; ?> <?php $colorfilter1 = get_post_meta($post->ID, 'checkboxwhite', true); $colorfilter2 = get_post_meta($post->ID, 'checkbox_beige', true); $colorfilter3 = get_post_meta($post->ID, 'checkbox_brown', true); $colorfilter4 = get_post_meta($post->ID, 'checkbox_gray', true); $colorfilter5 = get_post_meta($post->ID, 'checkbox_black', true); $colorfilter6 = get_post_meta($post->ID, 'checkbox_vvid', true); if ($colorfilter1 != "") $colorfilter1 ="white "; if ($colorfilter2 != "") $colorfilter2 ="beige "; if ($colorfilter3 != "") $colorfilter3 ="brown "; if ($colorfilter4 != "") $colorfilter4 ="gray "; if ($colorfilter5 != "") $colorfilter5 ="black "; if ($colorfilter6 != "") $colorfilter6 ="vivid "; $class_color = $colorfilter1.$colorfilter2.$colorfilter3.$colorfilter4.$colorfilter5.$colorfilter6; ?> <div class="col-1 mcol boxes<?php if( $i%3 == 0 ) { echo '-1'; }; $i++; echo ' '.$class_color;?>" id="colbox<?php echo $id1; $id1++;?>" data-id="click" > <div class="post" id="post-<?php the_ID(); ?>"> <figure class="indent-bot"> <?php the_post_thumbnail(array(380,220,true)); ?> </figure> <div class="col-1-content"> <strong class="title-3"> <?php the_title(); ?> </strong> <div class="entry"> <?php the_excerpt(); ?> </div><!-- .entry --> </div><!-- .col-1-content--> </div><!-- .post --> </div><!-- .boxes --> <?php else : break;?> <?php endif; ?> <?php endwhile; ?> <?php $reset = 0; $offset +=3; ?> <?php wp_reset_postdata(); ?> <?php while($loop2->have_posts()) : $loop2->the_post(); if ($reset1<3) : $reset1++; ?> <?php $numbercolor1 = get_post_meta($post->ID, 'numbercolor1',true); $numbercolor2 = get_post_meta($post->ID, 'numbercolor2', true); $imgaddr1 = get_post_meta($post->ID, 'imgaddr1', true); $imgaddr2 = get_post_meta($post->ID, 'imgaddr2', true); $imgssilka1 = get_post_meta($post->ID, 'imgssilka1', true); $imgssilka2 = get_post_meta($post->ID, 'imgssilka2', true); $namecolor1 = get_post_meta($post->ID, 'namecolor1', true); $namecolor2 = get_post_meta($post->ID, 'namecolor2', true); ?> </div> <div class="full clearfix active colbox<?php echo $id2; $id2++;?>" id=""> <div class="inner"> <figure class="indent-bot1"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_post_thumbnail(array(960,690)); ?> </a> </figure> <div class="row"> <div class="col-md-5"> <div class="inf-1"> <h4></h4> </div> <div class="inf-2"> <h5><?php the_title(); ?></h5> <div class="desc"> <?php the_excerpt(); ?> </div> </div> <div class="clearfix"></div> </div> <div class="col-md-7 border-left"> <div class="inf-1"> <h4><</h4> </div> <div class="inf-2"> <ul> <li class="first-child"> <a href="<?php echo $imgssilka1; ?>" class="img-block"> <img src="<?php echo $imgaddr1; ?>"> </a> <div class="txt"> <strong><?php echo $namecolor1; ?></strong> <span><?php echo $numbercolor1; ?></span> </div> </li> <li class="last-child"> <a href="<?php echo $imgssilka2; ?>" class="img-block"> <img src="<?php echo $imgaddr2; ?>"> </a> <div class="txt"> <strong><?php echo $namecolor2; ?></strong> <span><?php echo $numbercolor2; ?></span> </div> </li> </ul> </div> <div class="clearfix"></div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="c_btn"></div> </div> </div> </div><!-- .inner --> </div> <div class="container container-gallery"> <?php else : break;?> <?php endif; ?> <?php endwhile; ?> <?php $reset1 = 0; $offset1 +=3; ?> <?php wp_reset_postdata(); ?> <?php } //end if ($count <= $numberposts) } //end if ($numberposts) ?> <?php if ( have_posts() ) while ( have_posts() ) : the_post(); // ?> <article id="post-<?php the_ID(); ?>"> <?php the_content(); ?> </article> <?php endwhile; ?> </div><!-- .container --> </section>
harley
source share