Implementing in WordPress 2.7

The TweetBacks WordPress plugin imports tweets as comments, storing them in between your other comments in the database. When it does that though, it gives them a specific type "tweetback". Because of this, you can separate the tweetbacks from normal comments and pingbacks/trackbacks.

To do this on WordPress 2.7, follow the following tutorial:

  1. First, let's have a look at the default comment loop:
    <?php if ( have_comments() ) : ?>
      <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
      <ol class="commentlist">
      <?php wp_list_comments(); ?>
      </ol>
      <div class="navigation">
        <div class="alignleft"><?php previous_comments_link() ?></div>
        <div class="alignright"><?php next_comments_link() ?></div>
      </div>
      <?php else : // this is displayed if there are no comments so far ?>
        <?php if ('open' == $post->comment_status) : ?>
          <!-- If comments are open, but there are no comments. -->
        <?php else : // comments are closed ?>
          <!-- If comments are closed. -->
          <p class="nocomments">Comments are closed.</p>
        <?php endif; ?>
      <?php endif; ?>
  2. That's actually pretty simple, simpler than before 2.7, but we'll need to do a couple of things to separate the tweetbacks and trackbacks/pingbacks.
  3. First, open up your themes single.php file, and locate the following code:
    <?php comments_template(); ?>

    And change it to:

    <?php comments_template('',true); ?>
  4. Now open up comments.php, and find the following:
    <?php if ( have_comments() ) : ?>

    Add this below it:

    <?php if ( !empty($comments_by_type['comment']) ) : ?>

    And change this:

    <?php wp_list_comments(); ?>

    Into this:

    <?php wp_list_comments('type=comment'); ?>
  5. Directly underneath this wp_list_comments function you'll find </ol>, below this, add:
    <?php endif; ?>
  6. Now we'll add the tweetbacks below it:
    <?php if ( ! empty($comments_by_type['tweetback']) ) : ?>
      <h3 id="pings">Tweetbacks</h3>
      <ol class="commentlist">
      <?php wp_list_comments('type=tweetback'); ?>
      </ol>
    <?php endif; ?>

    And the pingbacks below that:

    <?php if ( ! empty($comments_by_type['pings']) ) : ?>
      <h3 id="pings">Trackbacks/Pingbacks</h3>
      <ol class="commentlist">
      <?php wp_list_comments('type=pings'); ?>
      </ol>
    <?php endif; ?>

For more customization, see this post by Sivel.