Support » How-To and Troubleshooting » Visual placement of comments

Visual placement of comments

  • 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?


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.

    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>
    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>';

    <?php endif; ?>

    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.
Skip to toolbar