Support » Plugins » Hacks » Minor Formatting Issue Can't Find Extra Space

  • Resolved Walton


    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.

    $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>' );?>
    <?php the_excerpt();
    endif; $counter++;
    echo "</div>";

Viewing 4 replies - 1 through 4 (of 4 total)
  • can you post a link to your site, pointing to this particular page?

    alignment issues usually depend on css/html interaction and are nearly impossible to analyse without working on the live site (for instance using firefox web developer add-on or firebug)

    Sure. It’s

    The reason that there are only 2 posts in the first two categories is that I don’t have much content up yet. That’s not an error with the loop (I assume!) Just trying to get everything the way I like it first.

    css for that div:

    .col {
    border-left: #A62800 double 3px;

    Sorry thought this got posted in my reply above.

    Found it. .col {margin-bottom:17px } was applying to each individual post, not the two post grid. Took that away and it works fine.

    Anyone who wants to pull posts from a custom taxonomy listed by value and/or display them in a grid format, I highly recommend the two articles I linked to above. Works great.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Minor Formatting Issue Can't Find Extra Space’ is closed to new replies.