I created an arbitrary record type, in the template file I put them in three columns. I need to do so that after a series of column entries, the same entries are made up of three entries with different criteria. And so every time for each row. Those duplicate entries under the row will be hidden through, display: none b and called when clicked. You can see how this works at: http://www.staron.com/staron/eng/contents/exhibition/list.do

At the moment I have the following code for the template (but it displays entries in three columns, but how can I insert the same entries after each row as I can’t figure out in the row):

<div class="container"> <?php $count = 0; $i = 0; $args = array( 'posts_per_page' => -1, 'post_type' => 'gallery', ); $gallery = new WP_Query( $args ); $arr = $gallery->have_posts(); if($gallery->have_posts()) : while($gallery->have_posts()) : $gallery->the_post(); ?> <div class="col-1 boxes<?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?>"> <div class="post" id="post-<?php the_ID(); ?>"> <figure class="indent-bot"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_post_thumbnail(array(380,220,true)); ?> </a> </figure> <div class="col-1-content"> <strong class="title-3"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_title(); ?> </a> </strong> <div class="entry"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_excerpt(); ?> </a> </div><!-- .entry --> </div><!-- .col-1-content--> </div><!-- .post --> </div><!-- .boxes --> <?php endwhile; ?> <?php else : ?> <?php endif; ?> 

  • In the example of your link records are requested from the server and are displayed by agax, and not stored in hidden blocks. IMHO, this path is more justified in this case - alenkins

1 answer 1

You can add the necessary content to a temporary variable, and then display its contents in the right place:

 <?php $count = 0; $i = 0; $args = array( 'posts_per_page' => -1, 'post_type' => 'gallery', ); $gallery = new WP_Query( $args ); $arr = $gallery->have_posts(); $hidden_content = ''; if($gallery->have_posts()) : while($gallery->have_posts()) : $gallery->the_post(); $hidden_content .= '<h1 class="post-title">' . get_the_title() . '</h1><div class="post-excerpt">' . get_the_excerpt() . '</div>'; ?> <div class="col-1 boxes<?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?>"> <div class="post" id="post-<?php the_ID(); ?>"> <figure class="indent-bot"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_post_thumbnail(array(380,220,true)); ?> </a> </figure> <div class="col-1-content"> <strong class="title-3"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_title(); ?> </a> </strong> <div class="entry"> <a href="<?php the_permalink(); ?>" rel="nofollow"> <?php the_excerpt(); ?> </a> </div><!-- .entry --> </div><!-- .col-1-content--> </div><!-- .post --> </div><!-- .boxes --> <?php if( $count%3 == 0 ) { echo $hidden_content; $hidden_content = ''; } ?> <?php endwhile; ?> <?php if( !empty($hidden_content) ) { echo $hidden_content; } ?> <?php else : ?> <?php endif; ?>