Seperating trackbacks and comments with WordPress
Many weblogs will have the comments mixed right in with the trackbacks. When I’d decided to support trackbacks, I thought about this method. Normally, you can’t tell what’s a trackback and what’s a comment without looking at the small slugline under the text itself. This is coming from someone who reads several weblogs every day — it must be even more confusing for someone who’s never seen one before, and they’re certainly not the easiest of concepts to grasp.
I thought about how to seperate trackbacks and comments. Colour scheming was the first obvious solution: one background colour for comments, another for trackbacks. But that needs a legend, and really is just confusing things. So my next thought was: why not seperate them completely? Comments normally just refer to other comments, rarely to trackbacks, so it shouldn’t be a problem taking trackbacks out of their correct place in time. So, with my WordPress installation, I set about hacking the wp-comments.php.
First, I needed to identify which comments were trackbacks and which were ‘actual’ comments. I could have possibly made the solution slightly more efficient by adding another column to the wp_comments table, but these functions work absolutely fine for me. (small note: I’ve lumped together trackbacks and pingbacks as from the users’ perspective there’s not much difference).
This function could then be used in the altered loop in wp-comments.php:
A similar function was used to get all the regular comments; that is, all the comments without ‘<trackback/>’ within the comment_content. So, the function is exactly the same, but with the negation operator, !, in front of the strstr() call. I used a seperate loop to display the regular comment, but that was very similar to the one above. The entire thing therefore, looks like this:
