Minor Formatting Issue Can't Find Extra Space
-
Put together a query to get 2 posts per term in a particular taxonomy and then display then horizontally. (Credit where credit is due, I merged the query posts by taxonomy loop from this post with this grid format
Works great, but the last post title is down lower than the second to last. It looks like for all the term headings, col-1 and col-2 are lined up, but for the last one, col-2 starts directly under col-1, adding an extra break.
I can’t find the issue (I’m not really a programmer just an expert cut and paster). Would really appreciate the help.
<?php $terms = get_terms('skill'); foreach ($terms as $term) { $num_cols = 2; $wpq = array ('taxonomy'=>'skill','term'=>$term->slug,'showposts'=>2); $query = new WP_Query ($wpq); $article_count = $query->post_count; echo "<h3 class=\"term-heading\" id=\"".$term->slug."\">"; echo $term->name; echo "</h3>"; if ($article_count) { $posts = $query->posts; foreach ($posts as $post) { for ( $i=1 ; $i <= $num_cols; $i++ ) : echo '<div id="col-'.$i.'" class="col">'; $counter = $num_cols + 1 - $i; if( $counter%$num_cols == 0 ) : echo "<h2 class='entry-title'><a href=\"".get_permalink()."\">".$post->post_title."</a></h2>" ;?> <div class="entry-meta"> <?php echo get_the_term_list( $post->ID, 'level', 'Level: ', ', ', '<br>' ); echo get_the_term_list( $post->ID, 'skill', 'Skill: ', ', ', '<br>' ); echo get_the_term_list( $post->ID, 'area', 'Area: ', ', ', '<br>' ); echo get_the_term_list( $post->ID, 'theme', 'Theme: ', ', ', '<br>' );?> </div> <?php the_excerpt(); endif; $counter++; rewind_posts(); echo "</div>"; endfor; wp_reset_query(); } } } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Minor Formatting Issue Can't Find Extra Space’ is closed to new replies.