Skip navigation

Separating Comments and Trackbacks in WordPress – The Answer

WordPress 2.7 News Update: For information on the new structure of comments and trackbacks in WordPress 2.7, please see Migrating Plugins and Themes to 2.7 – Enhanced Comment Display in the WordPress Codex, Justin Tadlock – Making your theme’s comments compatible with WordPress 2.7 and earlier versions and Sivel – Separating Pings from Comments in WordPress 2.7.

This Tip Applies Only to Full Version WordPress Blogs. BACKUP FIRST.


WordPress blogs feature two types of comments: comments and trackbacks. The presentation of these “comments” are typically designed on WordPress Themes and many blogs in two ways.

The most common and easy method of displaying comments and trackbacks is to mix them all together, listing them in chronological order, as they come into the blog.

Another method is to separate the trackbacks (or pingbacks) from the comments.

What’s the difference?

What is the Difference Between a Comment and a Trackback?

A comment is an interaction between a reader and the blogger about the blog post. A trackback is a link to this post published on another blog post.

In general, a trackback link is a recommendation – or at least a notification – that someone has published something about your blog post.

In the earliest days of the web and search engines which led to development of modern SEO techniques, the developers used the citation method of lending credibility and value to a published document on the web. The more people who linked to it, the more valid it and trustworthy it must be. To make these citations visible, the Trackback was developed, displaying the links which track from one site to another on your blog post.

When websites became interactive, the need to separate the conversation from these mini letters of recommendation became important. Many like having the flow of the conversation move through the page with no interruptions from trackbacks. However, separation of the trackbacks from the comments was not as easy as many designers desired.

The problem with trackbacks is that they are often not related content which adds to the blog post or the conversation, but link or code or irrelevant content that can confuse or distract the reader. Many want to separate the trackbacks from the comments accordingly.

How to Separate Comments and Trackbacks in WordPress

Example of trackbacks and comments separated on a WordPress blog ThemeIn the early days of WordPress, many struggled to separate the trackbacks from the comments on their WordPress Themes. Finally, Noscope’s article on Separating Trackbacks & Pingbacks in WordPress (Pastebin copy of original file) brought us a clear and easy to understand technique for separating those trackbacks and comments.

  1. Copy from the text file Noscope provided on their site (you may have to hunt on the page for it because it can be hard to find against the overly dark web page design).
  2. Backup your comments.php template file.
  3. Create a new text file and paste in the code from the downloaded comments.txt file.
  4. If you have not customized your comments template file before, then save this file as comments.php and upload it to your site.
  5. Test it to see if the look matches your design and presentation. You should see any post that features comments and trackbacks will now show them separated instead of mixed together.

Noscope’s layout was to list trackbacks first and comments second. A lot of requests are made to list the comments first, comment box, then list the trackbacks last. This puts the most relevant information up near the blog post, and the least relevant at the bottom.

Switch the order to your preference.

Carefully select all the code between <? // Begin Trackbacks ?> and <? // End Trackbacks ?> and move it below <? // End Comments ?>.

Go through the code between the original comments template and the new one you downloaded from Noscope to make sure that all of customization is changed correctly in the new one file. This can mean changing the headings from h2 to h4 or whatever to match your site’s heading structure and design. Check that all the style references match to accommodate your customization of the comments section.

After making modifications to restore the customized look combined with the new separated sections, upload it and test it on your WordPress blog’s Theme. Also, run the site through some validation tests to make sure there are no errors in the code.

Think of this as comment laundry. Go separate your comments from your trackbacks.

Related Articles



Site Search Tags: , , , , , , , , , , , , ,

Feed on Lorelle on WordPress Subscribe Feedburner iconVia Feedburner Subscribe by Email Visit
Copyright Lorelle VanFossen, the author of Blogging Tips, What Bloggers Won't Tell You About Blogging.

15 Comments

  1. Posted October 11, 2005 at 10:16 am | Permalink

    This only seperates the /presentation/ of trackbacks in wordpress. The backend pipeline is still shared between comments and trackbacks, which makes developing comment plugins quite tedious.

  2. Posted December 10, 2005 at 2:11 pm | Permalink

    Thanks for this extra documentation for my comments.php file.

    On a sidenote, my recently released Fauna theme ( http://www.noscope.com/fauna ) has trackbacks and comments separated by default, using a much cleaner method than the one in the other file. Not only are comment and trackback layouts separated out in separate files, but the file that includes both of these has been cleaned up as well.

  3. Posted December 10, 2005 at 2:33 pm | Permalink

    Excellent. I wish more Themes had these separated.

  4. Posted August 16, 2006 at 1:41 am | Permalink

    Lorelle, I migrated to WordPress (free version) from Typepad. So far, I can’t seem to make trackbacks or find the trackback URL for my blogposts. I feel stupid but – d-uh – how do I leave a trackback on other people’s blogs and open my posts to trackbacks?

  5. Posted August 16, 2006 at 6:45 am | Permalink

    Trackbacks happen automatically. If you have a link in your post to a blog or site that handles and accepts trackbacks, it happens automatically. If you would like to manually post a trackback, a link to a blog or site that is not included in your post content, then click the + next to TRACKBACKS in the Write Post Panel (below where you put your post content and upload images) and enter in the address/URL to the post you want a trackback to appear, or the general address to the blog itself. The latter will not appear on the blog visibly, but it still counts.

    In order for WordPress.com to handle the hundreds of thousands of trackbacks going every which way, there is a bit of a scheduling delay, so don’t expect them immediately. I’ve seen them take a couple minutes to a couple days depending upon a lot of different things. Usually they are there within 24 hours or less.

  6. Posted August 16, 2006 at 8:17 am | Permalink

    Hi Lorelle, thanks for the answer. I have included the post URL – and I guess I’ll wait until tomorrow to see if it appears on the other website. Cheers.

  7. mstegink
    Posted January 8, 2007 at 5:33 pm | Permalink

    In concept there is an easy way to solve this, just sort the comments on comment_type first and then on date. Depending on the sort (ASC or DESC) you could then list the comments separated from trackbacks and pingbacks, without having to go through all the comments twice like I do now. Unfortunately I don’t know how to do this sorting without hacking the WordPress global comment query, which I obviously don’t want because of compatibility reasons.

    I researched if I could add sorting to the global query through a plugin but I would need a hook which doesn’t seem te be available. Another way would be to sort the global comment array after it has been retrieved. I researched it quickly but I’ve never been great with arrays. See also http://www.bos89.nl/1157/

  8. Posted January 28, 2007 at 9:56 am | Permalink

    Hi Lorelle,
    thanks very much for this post. I have come across it a while back already, but only had the idea to finally separate my comments and trackbacks. Unfortunately Noscope’s Site is down and thus the txt file inacessible.
    Is there any repository to get the code?

    Thank you very much for all the good work you’re doing on the Codex. Someone just had to say it ;)

    Greetings
    Y.-

  9. Posted May 13, 2007 at 11:40 am | Permalink

    I did a google search on “WordPress separating trackbacks from comments” and your post came up straight away.

    This is wonderful. It works splendid. I will now go in and re add my pretty structure, but am impressed as of now. Thanks..

  10. Posted February 26, 2008 at 6:30 am | Permalink

    Have you tried this? Urban Giraffe article on separating comments from pings in WordPress. Tell me what you think.

  11. Posted February 26, 2008 at 9:18 am | Permalink

    @ ajicool:

    This article has been around for a long time and reflects the normal method as mentioned above. I believe that article was written before this one.

  12. Posted December 15, 2008 at 1:39 pm | Permalink

    I’ve included a pastebin copy of Noscope’s code. The site is fully functional and the code is still there, but this gives it a backup, just in case you cannot access it in the future.

  13. Mathew
    Posted December 11, 2012 at 1:02 pm | Permalink

    I know this if off topic but I’m looking into starting my own weblog and was wondering what all is needed to get setup? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% certain. Any suggestions or advice would be greatly appreciated. Many thanks

  14. Posted December 11, 2012 at 5:21 pm | Permalink

    Howdy! I know this is kinda off topic however I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest writing a
    blog post or vice-versa? My site covers a lot of the same subjects
    as yours and I think we could greatly benefit from each other.
    If you’re interested feel free to shoot me an email. I look forward to hearing from you! Wonderful blog by the way!

    • Posted December 11, 2012 at 5:33 pm | Permalink

      Thank you for contacting me, however in the future, I recommend that you contact bloggers appropriately through their contact form, not a comment on their site. Please see my policy on guest blogging on my contact form. Your site does not cover the same topics, so it is unlikely that I will comply, but thank you for asking.


6 Trackbacks/Pingbacks

  1. [...] Lorelle’s Site [...]

  2. [...] Separating Comments and Trackbacks in WordPress – The Answer [...]

  3. [...] of debate over how to display trackbacks and comments on your blog, whether trackbacks should be included in comments or separated from them, or whether or not they have any validity today. When I overhear someone discounting trackbacks, I [...]

  4. […] Separating Comments and Trackbacks in WordPress – The Answer […]

  5. […] Separating Comments and Trackbacks in WordPress – The Answer […]

  6. […] Separating Comments and Trackbacks in WordPress – The Answer […]

Post a Comment

Follow

Get every new post delivered to your Inbox.

Join 20,963 other followers

%d bloggers like this: