wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

Separate trackbacks from comments

wordpress snippet

Adding this code to your comments.php replacing the default comments loop will allow you to separate trackbacks from comments.

snippet :  PHPcopy
<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>
source →
jqsnipp.com | we just launched jquery snippets website