Display query output in two columns?
-
Is there a way to modify this code so that the title list displays in two columns? Preferably not a method that depends on CSS.
function list_posts_by_taxonomy( $post_type, $taxonomy, $get_terms_args = array('exclude' => array(4, 15, 17, 18, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 86, 87, 88, 89)), $wp_query_args = array() ){ $tax_terms = get_terms( $taxonomy, $get_terms_args ); if( $tax_terms ){ foreach( $tax_terms as $tax_term ){ $query_args = array( 'post_type' => $post_type, "$taxonomy" => $tax_term->slug, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby'=> 'name', 'order' => 'ASC', 'ignore_sticky_posts' => true ); $query_args = wp_parse_args( $wp_query_args, $query_args ); $my_query = new WP_Query( $query_args ); if( $my_query->have_posts() ) { ?> <h2 id="<?php echo $tax_term->slug; ?>" class="tax_term-heading"><?php echo $tax_term->name; ?></h2> <ol class="taxonomy-list"> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php if(strpos(get_the_title(), 'Anthology') === false) { ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> <?php $terms = get_the_terms( $post->ID , 'series' ); if($terms) { foreach( $terms as $term ) { if ( $term->description !== '' ) { echo '(' . $term->description . ') '; } } } ?> </li> <?php } ?> <?php endwhile; ?> </ol> <?php } wp_reset_query(); } } }I tried modifying this code, but I can’t seem to get it too work.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Display query output in two columns?’ is closed to new replies.