WordPress Tip: How To Separate WordPress Trackbacks and Comments

Writing by Brick Marketing on Friday, 25 of January , 2008 at 7:13 am

I have not seen this WordPress tip in many places, however I think it can be a worthy blogging tip to put into practice. If you receive a lot of trackbacks on your blog you will notice that they get mixed in with the comments. First, a simple definition of a trackback.

[source] A Trackback is one of three types of Linkbacks, methods for Web authors to request notification when somebody links to one of their documents. This enables authors to keep track of who is linking to, or referring to their articles. Some weblog software programs, such as Wordpress, Movable Type and Community Server, support automatic pingbacks where all the links in a published article can be pinged when the article is published.

So essentially a trackback is one blog advising another blog that there is a link connecting them and that the link comes from a particular article. The receiving blog pings back and it is that ping back that often ends up in the comments area. You have two choices, delete the trackback or leave it inplace. Trackbacks can be valuable for linking so it is often wise to leave the trackback in. However the trackbacks dotted through your comments make it look a little untidy. Follow these steps and our comments will not only look tidy, they will look professional. Before starting - make a copy of your comments.php file, just in case you make an error.

Step one: Open for editing your comments.php file and locate the following code.

<?php foreach ($comments as $comment) : ?> immediately after this code place this:

<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>

Step two: locate the following piece of code:

<?php endforeach; /* end for each comment */ ?> place this code on the line before:

<?php } /* End of is_comment statement */ ?>

Step three: locate this piece of code:

<?php else : // this is displayed if there are no comments so far ?> immediately before place this code:

<h3>Trackbacks</h3>
<ol>
<?php foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type != ‘comment’) { ?>
<li><?php comment_author_link() ?></li>
<?php } ?>

<?php endforeach; ?>
</ol>

All done. Save the file and go into any post that has a mix of trackbacks and comments. This WordPress tip is easy to put into place and provides a nice neat look to your blog software.

Blog and Website Design & Website Development Price Quotes – Compare and Save!


Category: Blog Software, Blogging Tips, WordPress tips

1 Comment

Comment by Martin

Made Wednesday, 30 of July , 2008 at 1:48 pm

Very good web site, great work and thank you for your service.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Blog Marketing Journal


Blog Marketing Journal is a Blog that discusses How to Build, Write Market and Promote a Business Blog for the new and advanced reader.
Learn more about this blog.