X

Separate trackbacks from comments

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


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

Comments  Leave a Reply

  1. Tweets that mention Wordpress Separate trackbacks from comments – wpsnipp.com Wordpress code snippets for your blog -- Topsy.com November 21, 2010 at 8:51 pm

    […] This post was mentioned on Twitter by Aaron Holland, WPSNIPP. WPSNIPP said: #wordpress Separate trackbacks from comments http://bit.ly/9IOcuZ #blog please RT 🙂 […]

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!