Split query results into even columns
-
I would like to split this query into X equal columns without using multiple queries.
First i’d like to get the count of the total # of posts, then divide them by 2 (or any number of columns at that). After that, through the loop, split the results using a count.
here is my current code:
<div class="entry-content"> <?php query_posts( array( 'post_type' => 'widget' ,'category__in' => array( 16 ) , 'orderby' => 'title', 'order' => 'ASC', 'posts_per_page' => -1 ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div > <h3 > <?php $key="widget_name"; echo get_post_meta($post->ID, $key, true); ?> </h3> <div><?php the_content();?></div> </div> <?php endwhile; endif; wp_reset_query(); ?> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Split query results into even columns’ is closed to new replies.