• For my comments section of my blog, I’m only displaying pings and trackbacks. However, rather than place them within the permalink’s main body, I’d very much like to place it the side column.

    Unfortunately, the comments template tags only work *within* the loop, and the side column falls outside the loop. Is there a way around this?

    Thanks,
    marc

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here’s how one theme (Identification Bands by Neuro) does something similar with comments. I don’t know what you’d need to change exactly to show trackbacks and pings instead, but it shouldn’t be too tough.

    <?php
    global $comment;

    if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved='1' ORDER BY comment_date_gmt
    DESC LIMIT 5") ) :
    ?>

    <h2 class='coltitle'><?php _e('Last Comments'); ?></h2>
    <ul>
    <li>
    <ul>
    <?php
    foreach ($comments as $comment) {
    echo '<li>' . sprintf('%s <span style="text-transform: lowercase;">on </span>%s', get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
    echo '</li>';
    }

    ?>
    </ul>
    </li>
    </ul>
    <?php endif; ?>

    Thread Starter marc0047

    (@marc0047)

    Thanks for the tip.

    I also tried calling the “sidebar” in the default Kubrick style and activated the comments, and that worked too. So comments does in fact work outside the loop.

    The most important element that *must* be called is the ‘comments_template()’ function, and everything will work fine.

    If the function is not called, it’s like turning the light switch off.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Visual placement of comments’ is closed to new replies.