how to list events in a grid
-
Hi all,
I wrote a simple code to list events in 2 column grid but I miss something, there is nothing placed in my second column just in the first.
here is my content-grid template code:<?php $args = array( 'post_type' => 'event', 'posts_per_page' => 10, 'meta_query' => array( array( 'key' => '_start_ts', 'value' => current_time('timestamp'), 'compare' => '>=', 'type'=>'numeric' )), 'orderby' => 'event_start_date', 'order' => 'DESC' ); $loop = new WP_Query( $args ); $num_cols = 2; // set the number of columns here for ( $i=1 ; $i <= $num_cols; $i++ ) : echo '<div id="col-' . $i . '" class="col" >'; $counter = $num_cols + 1 - $i; while ( $loop->have_posts() ) : $loop->the_post(); if( $counter%$num_cols == 0 ) : // begin of core posts output ?> <strong><?php echo EM_Events::output( $args );?></strong> <?php endif; $counter++; endwhile;?> <?php rewind_posts(); echo'</div>'; endfor; ?> <?php if ( $wp_query->max_num_pages > 1 ) : ?> <div id="nav-below" class="navigation"> <?php if(function_exists('page_navi')) { page_navi(); } else { ?> <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> <?php } ?> </div><!-- #nav-below --> <?php endif;?> <?php wp_reset_query(); ?>
any ideas?
thank you
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘how to list events in a grid’ is closed to new replies.