Separate Trackbacks

The trackbacks might be useful function for thanking the bloggers out there spreading your blogpost, but they are kinda ugly. It’s easy to separate them from the comments.

This goes in comments.php.

Code Snippet:

<?php
// Find:
foreach ($comments as $comment) :
    // Comments are displayed here
endforeach;
?>

<?php 
// And replace with: 
?>
<ul class="commentlist">
    <?php //Displays comments only
	foreach ($comments as $comment) : ?>
       	<?php $comment_type = get_comment_type(); ?>
       	<?php if($comment_type == 'comment') { ?>
	    <li>//Comment code goes here</li>
	<?php }
    endforeach;
  ?>
</ul>

<ul>
<?php //Displays trackbacks only
	foreach ($comments as $comment) : ?>
    <?php $comment_type = get_comment_type(); ?>
      <?php if($comment_type != 'comment') { ?>
	      <li><?php comment_author_link() ?></li>
  <?php }
  endforeach;
  ?>
</ul>

Posted in Comments