Trackbacks are the messages displayed in the comments list whenever another blog links back to one of your posts. Many blogs disable trackbacks, but not all.
If you use trackbacks on your blog, it is best if they are not mixed with the comments. The comments are a conversation between between real people. Having machine-generated links in the middle of that will only serve to disrupt the conversations.
The method described here will lift out all of the trackbacks, and then display them as a numbered list after the list of comments is finished. Once you have this done, customizing the trackbacks to appear however you want them to is simple.
And thanks to Gary, the Trackbacks header will only appear if the post has a trackback to show.
NB – This method will only work for WordPress users. Sorry guys!
How To Separate the Trackbacks
Open comments.php, and search for the following line:
<?php foreach ($comments as $comment) : ?>
After it, paste the following:
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>
Now look for:
<?php endforeach; /* end for each comment */ ?>
And before it, paste:
<?php } else { $trackback = true; } /* End of is_comment statement */ ?>
That means that your list of comments will continue to display as normal, but without any trackbacks or pingbacks. Now we will add a second comments loop for the trackbacks.
Look for the following line:
<?php else : // this is displayed if there are no comments so far ?>
And before it, paste this: (The “Trackbacks” title line can be deleted if you don’t want a heading to be shown)
<?php if ($trackback == true) { ?>
<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>
<?php } ?>
Of course, this is all only helpful if you actually use trackbacks, and there are some good reasons for either side of that debate. Do you use trackbacks on your blog? Why?
Custom Search
goldfries (81 comments)18 September 07
Strange, I get notified about trackbacks and I do see them on my WPadmin Comments section but it doesn’t appear on my posts’ comments section even without any modifications.
Did I miss out something?
Michael Martin (1319 comments)18 September 07
Your theme may already be set up to block them out.
If they appear in your comments area, it does mean that they’re enabled and have been saved as post comments.
redwall_hp (139 comments)18 September 07
I’ve been meaning to do this for a while now, but I haven’t decided whether I should put trackbacks above or below comments.
Michael Martin (1319 comments)18 September 07
It depends on the blog Matt, but on Webmaster Source you follow each post with a list of related posts. You wouldn’t want to have that followed immediately by another list of links.
sarahG (15 comments)18 September 07
I used to kill trackbacks due to them being 99% spam, however I switched them back on as I think it’s good to have a link to other posts mentioning yours. Trouble is I’ve broken it all now and they don’t seem to appear!
Separating them is a good idea. I’ve seen it in the past and it does make things flow better
Liberty and New Creation (6 comments)18 September 07
Hah. I was JUST wondering how to do this after stumbling across another blog that did so.
Thanks for the practical advice. You’ve once again confirmed that I need to stay subscribed to your feed.
Michael Martin (1319 comments)18 September 07
Sarah – Morally I do think it’s nice. I don’t use them here though because they aren’t necessarily links that I recommend. If there is going to be a list of links, it should be a hank-picked list that I have chosen specifically for my readers. (I suppose that’s more of a problem for smaller blogs, like this one. Larger blogs probably get a lot nicer trackbacks! xD )
Liberty – Yes! You must always stay subscribed. For ever and ever and ever! :p
Slevi (73 comments)18 September 07
Nice little guide
, since I don’t get many trackbacks I don’t think it’d really matter in which way I display them to begin with though
. By far the most avid trackbackers for my blog are spammers, hehe. Those are nicely being blocked from public of course.
But I’ll keep this in mind for if it ever would occur that I would start getting a lot of them
.
Michael Martin (1319 comments)18 September 07
I hope that that will be the case someday Slevi. For 2 reasons.
David Hopkins (8 comments)18 September 07
WordPress is so messy with its PHP in the HTML. I wonder how long it will take for a new higher grade blogging software to knock them of their spot?
Michael Martin (1319 comments)18 September 07
I like that aspect of it David. It gives you complete control over the design through only the templates files. Very rarely have I had to touch the actual WP’s files. At the very least, it makes upgrading easy.
Connor Wilson (8 comments)19 September 07
I use a much more complicated way of doing this, but it allows me to count them separately and run totally different loops for them.
My comments.php is huge because of all this
Slevi (73 comments)19 September 07
@David: Probably very long, the majority of the users simply couldn’t care less about messy code. Living proof of that is mySpace, it has even the shittiest page source and I highly doubt their backend is much better but meanwhile it is one of the best visited sites in the web.
As inefficiently wordpress might be doing a couple of things currently, the amount of people actually caring about it is just too small to make a change.
Michael Martin (1319 comments)19 September 07
Connor – You can do that with this code as well. I originally set it up on this blog, where we do count the comments, and it’s already running two seperate loops.
Of course, the nice thing about coding is that there are always a few ways to achieve the same goal. ALl are equally valid.
paidtwice (5 comments)20 September 07
Yay it worked! Thank you!
I never managed to get the author coded different color one to work (for some reason my email address isn’t recorded when I myself comment? hmm) but this one worked
. Thanks!
One small question: if I wanted it to say something innocuous like “Trackbacks:” before the list of trackbacks, where would I write that (and how) in the code to do that?
Steven Snell (24 comments)20 September 07
I like seeing them separated on other blogs, and I’ve been thinking about doing it one mine. I just haven’t made the time to do it, so thanks for the reminder.
Michael Martine with an E (3 comments)20 September 07
One thing I like about using the Sandbox theme as a basis for custom WordPress themes is that separation of comments and trackbacks/pingbacks is built into it.
I like to reward commenters and linkers, so I have removed “nofollow” from my blog and feature a recent trackbacks list on my home page (as well as recent comments). I definitely believe in showing trackbacks!
kristarella (141 comments)20 September 07
Nice! I’ve seen this once or twice on blogs and thought it was kind of cute.
Perhaps I will do this on my blog, even though I get very few trackbacks!
Michael Martine with an E – I started making a theme based on Sandbox and found the code to be so bloated and messy that I didn’t know where to start! How do you find working with it?
Michael Martin (1319 comments)20 September 07
paidtwice – Glad it helped! Sorry to hear the author one didn’t work so well. The code does work, but I may have been a little grey with some of the instructions. I’ll just have to be more clear in future!
To add the “Trackbacks” heading, look for the last section that you pasted in, beginning with:
<ol>< ?php foreach ($comments as $comment) : ?>
Before that, paste the following:
<h3>Trackbacks</h3>
That will do it.
Steven – No problem.
Michael – First off, I love the name! Secondly, it’s a nice thing to show trackbacks like that. I have nofollow removed here, but not the trackbacks. I’m a little worried about their impact on SEO, and that they mightn’t always be overly relevant links.
kristarella – It’s always an option! There’s no need to do it, especially if you aren’t showing trackbacks at the minute anyway, but if you are, I think it’s a good way of doing it.
paidtwice (5 comments)20 September 07
Thanks! That worked great!
No worries on the author color comment thing, I am not skilled at coding… anything.
I may have messed something up. I intend on trying again
Future topic suggestion…. how you make your columns start lower and extend your header on that one part to put that quote in. That would rule (if I could figure it out that is lol).
Michael Martin (1319 comments)20 September 07
Glad it worked!
Thanks for the idea, but it would be a little harder to explain. It’s actually quite easy to do (For a coder that is), but because every theme is so different, it wouldn’t be as easy as copying&pasting. You would need a basic understanding of CSS I’m afraid, to work out the specifics for your own theme.
(I do plan on writing some articles that would give you that basic understanding in the future, but not just yet!)
goldfries (81 comments)20 September 07
Arrggh. I just found out it appeared in one of my post.
This post of yours is going to be useful.
Michael Martin (1319 comments)20 September 07
Well, it will if it works!
*fingers crossed*
Moses Francis (1 comments)21 September 07
I totally agree with you, it’s always best to seperate trackbacks and human comments.
Laarni (4 comments)21 September 07
I’m going to try this.
Thanks.
Michael Martin (1319 comments)21 September 07
Moses – Agreed. Combining them only leads to confusion and annoyance.
Laarni – Glad to hear it. Good luck! (Let me know if you have any problems.
)
JHS (4 comments)22 September 07
Hi there: I started to implement this and then discovered that there is verbiage in my theme indicating that pings/trackbacks and comments are already separated. But the trackbacks are not appearing. How can I tell if they have been disabled and how do I allow them again? I am getting e-mail notifications of them and they are included in my total comment count, but they don’t actually appear on my site.
Thanks.
kristarella (141 comments)22 September 07
You’re using a modified Copyblogger – I found that code in my theme too (also Coppyblogger). I don’t think that the function separating them is activated by default in CB – from Chris’s comment about it. Are you sure that your trackbacks are not showing up as comments? Perhaps they can be excluded from the admin?
In light of the function not being active you could probably still use this code and leave that over code alone (I’m thinking of doing that).
Suzanne of New Affiliate Discoveries (2 comments)22 September 07
Wow, great tip, I was just looking into how to do this. you’ll definately be getting a trackback from me in this weekends Sunday Seven edition!
JHS (4 comments)22 September 07
Kristarella: I love what you’ve done with the CB theme!
Unfortunately, this won’t work for me because the language referenced is not in the comment.php file, so I don’t know where to start to implement this work around.
I’m sure . . . my trackbacks and pings are definitely not showing up at all except in my dashboard.
Thanks.
kristarella (141 comments)22 September 07
Thanks JHS, I appreciate the compliment
I think I found the code – look for:
<?php $count_pings = 1; foreach ($comments as $comment) { ?>and
<?php $comment_number++; } /* end for each comment */ ?>They should be the places that you need to put code after and before respectively, according to Michael’s instructions. I haven’t tested it, so make sure you back up your comments.php incase it doesn’t work.
The ‘php else’ code that you place the trackback code before is the same.
p.s. Sorry in advance if that code doesn’t show up properly – I never know how WP processes these things!
Michael Martin (1319 comments)22 September 07
JHS – If they had been disabled, you wouldn’t get any notification of them. Let me know if Kristarella’s advice works for you. If it doesn’t, I’ll try out the copyblogger theme myself and see what needs to be done.
Kristarella – Thanks for helping out!
Suzanne – Thanks! Hope it works out for you.
kristarella (141 comments)22 September 07
No worries
I’m trying out your code right now with the code that I just mentioned and it seems to be working – just needs a bit of styling. However, my trackbacks were showing up as comments, so I’m not sure what’s happening there.
kristarella (141 comments)22 September 07
Oops – unclear comments – I meant my trackbacks were showing up before, so I don’t know if what I’ve done to my file will work for JHS.
Anyway, it’s all working nicely. Thanks for the instructions!
Michael Martin (1319 comments)22 September 07
No problem. If they were showing up before then the code above should definitely work, if you’ve tweaked it for Copyblogger.
JHS (4 comments)22 September 07
I tried placing the code where Kristarella suggested.
You can see the result here:
http://www.jhsiess.com/hereslo.....-on-track/
You see 5 comments there.
But if you go to the homepage, you will see that under the post excerpt (it is the last post on the front page), the verbiage is “17 Comments.”
I use the Better Comments Manager plugin and I have a total of 17 comments, pings and trackbacks there.
So they are coming in, but are not showing up.
Thanks for any assistance you can provide!
JHS (4 comments)22 September 07
Kristarella: Would you be willing to share your comments.php file with me? If you e-mail it to admin@jhsiess.com, I can compare your file with mine and perhaps figure out what’s going on.
Thanks.
kristarella (141 comments)23 September 07
I see what you mean JHS, that’s weird the 17/5 comments thing. There is a chance that a plugin is causing that Even though the plugin doesn’t really have anything to do with trackbacks. How much do you actually use that plugin?
I can email you my comments file. No problem.
paidtwice (5 comments)23 September 07
I use the Better Comments Manager too and it doesn’t hide my trackbacks. But I run a different theme so it may not matter. lol
Michael Martin (1319 comments)23 September 07
Just wanted to say thanks again Kristarella, and paidtwice now. It’s good of yous to help out.
Tay (2 comments)24 September 07
Thank you, thank you, THANK YOU!
I’ve just implemented this on my blog and it worked perfectly. I appreciate you sharing this advice.
Michael Martin (1319 comments)24 September 07
No problem Tay. Glad it worked for ya.
pablopabla (50 comments)28 September 07
I just got back from vacation and am now catching up on your articles. Thanks Michael! I’ve pasted the codes and they are working perfectly. I was wondering whether it is possible to put a custom message immediately above the Trackbacks? I tried that but this message also comes up in posts without trackbacks.
kristarella (141 comments)28 September 07
Hey pablopabla,
I’m not great with php, but I think I have what you’re looking for.
<ol class="trackbacks"><?php foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type != 'comment') { ?>
<h3>Trackbacks ↓</h3>
<li><?php comment_author_link() ?></li>
<?php } ?>
<?php endforeach; ?>
</ol>
In the h3 tag I’ve got my Trackback title, which should only show up when there are trackbacks (because it’s after the “if” thing. You could put whatever you want there.
pablopabla (50 comments)28 September 07
Thanks Kristarella.
However, I notice that the “Trackbacks” wording repeats itself for each and every Trackback on the posts. :O
kristarella (141 comments)28 September 07
Bother! You are absolutely right. I actually have so few trackbacks that it was difficult to find a post with 2 on it! (I guess I’m hoping for more in the future
)
In that case, I too would like an answer to the question!
Michael Martin (1319 comments)28 September 07
Hey pablopabla! Nice to see you again.
I’m going to add that into the post now. Another commenter asked the same question. You can read my answer here in the meantime.
Kristarella – Incase you’re interested: the problem with yours is just that the foreach(… line is the start of a loop. Everything between that an endforeach is repeated for every item (trackback) on the article.
Brian Purkiss (24 comments)30 September 07
That’s a good idea!
But, do you have an example?
A screenshot of the results would be very helpful in deciding if I’m going to use that.
(I most likely will, but a screenshot will be helpful)
Michael Martin (1319 comments)30 September 07
Yep, the articles on SkellieWag display trackbacks like this.
Brian Purkiss (24 comments)30 September 07
Thanks so much!
I am going to use that now!
Michael Martin (1319 comments)30 September 07
No problem. Let me know if you have any problems.
pablopabla (50 comments)1 October 07
Thanks for the tip Michael. However, is it possible to further tweak it so that the customisation (the line between the ) does not appear at all when there are no trackbacks to a post? At the moment, the customisation appears in all posts.
Gary (4 comments)19 October 07
Thanks for the great tip on trackbacks.
To have the trackbacks showing only if there are some is quite easy change to make…following your original instructions, instead of this:
Do this:
And instead of this:
TrackbacksDo this:
Trackbacks
Michael Martin (1319 comments)19 October 07
Hey Gary – Thanks for trying to help out, but there’s no code in your comment. Did something go wrong?
Gary (4 comments)19 October 07
Hey Michael
Hmm, seems to have gone wrong. No matter, see http://www.osworld.biz/1004/se.....-comments/
Cheers, Gary
Michael Martin (1319 comments)19 October 07
Looks good now, thanks.
Forrest (25 comments)21 November 07
This is fantastic … thanks so much for the tip! I’ve seen a lot of blogs doing this and always wondered how. I agree they interrupt the flow of conversation, but I’ve been told by people smarter than I am that trackbacks are helpful.
One question, though, since I don’t know that much PHP … how would I make the text Trackbacks and the ordered list underneath it only show up when there are more than zero trackbacks?
kristarella (141 comments)21 November 07
Hey Forrest – this is a really great solution. I agree that trackbacks interrupt the comversation.
See Gary’s comment for the solution to that issue. I’m using his code on my blog.
Michael Martin (1319 comments)21 November 07
Hehe – You must be subscribed to this post Kristarella. Thanks for helping Forrest out.
Forrest (25 comments)27 November 07
I guess I should have read all of the comments first…! Before I came back and saw that, I implemented more or less the same thing in javascript, but this is a cleaner solution overall. So for the second time thanks!
Michael Martin (1319 comments)27 November 07
lol – I wonder if Kristarella will pop in to say “Welcome”
kristarella (141 comments)27 November 07
I usually only come back when someone has an issue that they’re trying to solve
Michael Martin (1319 comments)27 November 07
Fair enough. I’m just glad you do.
Nathan Chapman (4 comments)4 January 08
Thanks for this tip, it’s helped
One thing though. My site keeps on making trackbacks to itself whenever I link back to another article of mine. Can I stop it from doing this? I’m using WP 2.3.2
Michael Martin (1319 comments)4 January 08
Nathan,
I’ve disabled trackbacks here, so I can’t say anything for certain, but this plugin looks good. If you try it, let me know if it works please.
Nathan Chapman (4 comments)5 January 08
Thanks for the link Martin, and yes the plugin does work, for all you people out there with the same problem.
Michael Martin (1319 comments)5 January 08
Nathan, glad to hear it and thanks for letting us know (I’ve bookmarked it now
)
Forrest (25 comments)5 January 08
WordPress automatically sends itself trackbacks, and auto-publishes them. I go back and delete them manually; occasionally I’ll actually want to let one remain.If a reder discovers my blog through an old post, [self] trackbacks are a good way to connect that post to other specific ones on the same subject, or that refer to it in a meaningful way. My post on The Gorge is a good example.Food for thought, anyway…
Michael Martin (1319 comments)5 January 08
Forrest, that would work as well, and it does give you more control over the process, but I think that having to manually delete a link every time I interlink my posts would bug me, and probably put me off interlinking.
(Though perhaps encourge me to link out more instead?)
Forrest (25 comments)6 January 08
My blog gets scraped a bit. It sounds like that’s been more of a problem either in the past or for other people, but it’s at least an annoyance.In a recent interview, Matt Cutts said that when Google sees the same content showing up on ten pages on ten different sites, but nine of them link back to one that doesn’t link out to any of the others, they assume it’s scraped, and transfer any pagerank the copies might attain to the original. ( He wasn’t clear about whether you need to link to the specific page or just back to the domain the original was published on? )It’s neighborly to link out, but I wouldn’t let the trackbacks stop me from linking back to earlier posts.
Michael Martin (1319 comments)6 January 08
Forrest, it sounds like the sort of thing that Google would be able to do (How hard can it be to catch on that a site is a splog?). They’re also becoming a lot more consious of the time that content showed up on certain sites, so if you publish an article first, and then splog rips it a few days later, Google should have found it on your blog first hopefully. That might stand for something.
And if you’re willing to take the time, then the manual way is great. I’m just a little lazy I suppose. With WP in the backend, I like to automate as much as possible.
kristarella (141 comments)6 January 08
Well, I got a little lost in this conversation. I think I got the gist though… I’ve had a few of those slightly dodgy trackbacks. Where the blog looked like nothing more than copying sections of text with a link to the author. One of them was extremely dodgy and caled me “americanshopper” rather than “kristarella”!
Should I delete all trackbacks that don’t look useful to me?
kristarella (141 comments)6 January 08
BTW, not sure about this WYSIWIG comment editor. It’s a good idea, but it didn’t keep some of my line breaks just then, and it seems to insert some extra code that I get as plain text in emails when subscribed to comments.
Michael Martin (1319 comments)7 January 08
Kristarella – Yes, I’d delete the spammy trackbacks. Linking out to a spammy site is going to annoy your readers if they click the link, and could hurt you in Google (If it associates you with that spam site).
But I love the WYSIWYG! I haven’t had any problems with it yet (Bar some teething problems in IE7, which should now be fixed).
The line-breaks you lost, were they multiple line breaks in a row? If so, I think that was WordPress, not the editor.
kristarella (141 comments)7 January 08
Haha, ok.
I’d just hit enter a couple of times, I don’t know what WP usually inserts there.
See how it goes this time.
Edit: oh, it didn’t work. I’ve added all those breaks manually. Normally hitting enter adds a break or ends a paragraph, unless you turned it off. Curious. Maybe just my browser.
Tip Diva (1 comments)7 January 08
Spectacular – works great! Thank you!
Michael Martin (1319 comments)7 January 08
Kristarella,
Hmm, what browser are you using? I’ll try it out as well.
Tip Diva – Glad it worked for you.
kristarella (141 comments)7 January 08
I was using Camino the last couple of times.Now I’m trying Safari.
Michael Martin (1319 comments)7 January 08
I’m in Safari now. Let’s see how it goes.
I don’t have Camino though (Windows user).
EDIT – It left out the line breaks on me as well. I’ll head over to the support forums to see if anyone else has had this problem.
Michael Martin (1319 comments)7 January 08
And now that I’ve added more code;
Will
This
Work?
(Sorry about the emails Kristarella! xD )
EDIT – The line breaks worked for me now. What about you?
cekay (1 comments)20 January 08
Thank you very much for this information. Found it via google cause it’s annoying to have a trackback look like a comment. your hack works exactly as i wanted it!
Corrina (1 comments)29 January 08
THANK YOU for this post! It was making me crazy that my trackback’s were coming in as comments. Now that’s all fixed.
Michael Martin (1319 comments)29 January 08
Glad it worked for yous
Millionaire Money Habits (5 comments)1 February 08
Looks great, but I get a W3.org invalid page error. Do you know how to fix this?
end tag for “ol” which is not finished
Most likely, you nested tags and closed them in the wrong order. For
example <p><em>…</p> is not acceptable, as <em>
must be closed before <p>. Acceptable nesting is:
<p><em>…</em></p>
Another possibility is that you used an element which requires
a child element that you did not include. Hence the parent element
is “not finished”, not complete. For instance, in HTML the <head> element
must contain a <title> child element, lists (ul, ol, dl) require list items (li,
or dt, dd), and so on.
Millionaire Money Habits (5 comments)1 February 08
to add to the above, it seems to only validate if there are either no comments and no trackpacks, or if there are both comments and trackbacks.If there are one and not the other on the post, then I get the invalid error above.
kristarella (141 comments)2 February 08
Millionare Money Habits – are you sure you’re implementing the code correctly?
I’m using this method and I don’t get validation errors. Here’s the output from a page that’s got lots of trackbacks. There are errors, but they’re all for a plugin that has nothing to do with this.
kristarella (141 comments)2 February 08
By the way, dig the new sidebar Michael. It’s really useful and easy to read.
Michael Martin (1319 comments)2 February 08
Millionaire Money Habits – The problem is that the original code put out some code, regardless of whether the post had any trackbacks or not.
I’ve updated it now though, thanks to Gary, with a few new lines that will fix that. The easiest way to fix your code would be delete the changes you made the other day (Sorry!), and then run through the post again.
Sorry for the hassle. I should have made that update a while back
Michael Martin (1319 comments)2 February 08
And Kristarella, thanks. There’ll be a post up about it in a day or 2.
Millionaire Money Habits (5 comments)2 February 08
Thanks Michael. I made the changes, but still get the W3C invalid response on posts that only have trackbacks and now comments.
Post that only have comments and no trackbacks are validating now, so there’s progress.
Thanks!
Michael Martin (1319 comments)2 February 08
MMH – Ahh yes, that problem would remain. There’s no easy way around that one. The only method I can think of is pretty messy and would involve running through all of the comments twice, just to check if there were any comments.
How important is the validation to you? It can’t be very often that you get a post with trackbacks but no comments, and the fix for those occasions would be putting on needless extra server load in every page.
Millionaire Money Habits (5 comments)2 February 08
I guess it’s no biggie – i’m just being anal in having my pages validate for SEO purposes.I guess the easy thing to do would be to just add a comment to those posts. Thanks for all the help and quick replies!
Michael Martin (1319 comments)2 February 08
SEO purposes? I don’t think that W3C valid code will have any impact on your SEO.
It might impact it if the errors were so bad that the search engines couldn’t make sense of your page, but with a tiny error like this, there’s nothing to worry about.
Millionaire Money Habits (5 comments)2 February 08
Oh, ok. I didn’t realize that. I thought it mattered for SEO. Thanks again!
Michael Martin (1319 comments)3 February 08
No problem. See you around.
milo (72 comments)4 February 08
Hum, I guess what comes around will come around.
Coincidense…
Ramil (1 comments)1 March 08
Thanks for the nice tip. I will implement this on my blog design.
Michael Martin (1319 comments)2 March 08
milo,
Sorry, I didn’t see your message before. But ack well, this code has been spread about in plenty of places by now.
Ramil,
No problem. Glad ya found it useful.
Merci (1 comments)8 March 08
Thank you Michael for sharing your tips. I wanted to do this for some time. I am so glad your instructions were clear and precise, it worked on the first try.Cheers and more power to you and your blogging!
Michael Martin (1319 comments)9 March 08
Merci,
I’m glad it worked for you, and that it was easy enough to follow!
Adam Kayce (2 comments)12 March 08
Oh, perfect! Like a charm.It was the “don’t show it if I don’t have any” that I was looking for, and this worked like an absolute charm.Thanks so much.
Michael Martin (1319 comments)12 March 08
Adam,
I like that as well. No need to mention trackbacks at all on a post that doesn’t have any.
Fabian (2 comments)16 March 08
Thanks for this article, you explain it really clearly.:)I’ll do this on my blog too, although it isn’t really necessary yet, I don’t get a lot of trackbacks and pingbacks.
AJ (6 comments)19 March 08
I’m loving this little trick. Really clearly explained. I never really get trackbacks, but it still is pretty usefule
Michael Martin (1319 comments)19 March 08
Fabian and AJ,
Ahh well. Just look forward to the times when you do get a lot of trackbacks, and a trick like this is needed.
dinsan (3 comments)28 March 08
Thanks .. it worked very well
djstelios (1 comments)28 March 08
Very good hack. I’ve used it on my blog and now I like more the comments area. It’s cleaner..Thanks
alialtugkoca (1 comments)28 March 08
nice tip,thanks
Brandon (2 comments)28 March 08
Thank you very much… this was very easy to follow and worked perfectly.
elena (3 comments)2 April 08
Thanks for the tip..nice work and site looks too nice
Mohit (2 comments)2 April 08
explaination is very clear and understandable
thanks
good luck
Michael Martin (1319 comments)2 April 08
No problem everyone. Let me know if you have any trouble with it.
Fay Webber (1 comments)15 April 08
Thanks for this article;
this is very useful and very clear – easy to use
Epic Alex (9 comments)30 April 08
This is a great tutorial, thanks a lot. I’m just off to implement it now.
I’ve wanted to do this for a while, as trackbacks take up as much space as a comment at the moment, and people(ie me on other blogs) tend not to be as interested in them.
Thanks again
Steve Patterson (1 comments)1 May 08
Hey thanks this worked for me!
Thanks very much, I spent a long while searching how to fix this and this was the easiest one and it actually worked. I appreciate it very much.
DazzleCat (8 comments)8 May 08
ive been reading this blog a while but this is my first comment. thank you for your article and your views
Cristian (1 comments)15 May 08
Great post. I’ve searching for this, and is really good explained. Thanks.
Divvy (5 comments)24 June 08
Great tip, thank you so much!!!
Btw, is there any code that makes possible to not count the trackbacks/pingbacks in the number of comments?
For example, in a post I have 5 comments.
1 for a user and 4 trackbacks.
I only want to show 1 comment instead of 5 comments.
Is possible? how?
Michael Martin (1319 comments)24 June 08
Divvy,
This plugin should do the trick for you: http://txfx.net/code/wordpress.....ent-count/
(Can’t guarantee it works on the latest version of WordPress though. The comments on that post are just full of spam sadly.)
Divvy (5 comments)25 June 08
arghhhhhhh almostttttttttttt…..
Is not working 100%, only appears the value, dont appears the word “comments”.
Appears for example “0″
Insteat of “0 comments”
Michael Martin, please can you give a look at the code for me? please?
If not, well, thank you anyway, it was a great help, better then nothing hehe
narendra.s.v (3 comments)25 June 08
thanks a lot! it worked for me but now i wanna use a ajax reply plugin and i tried to find those line in comment.php file but there is no lines
Michael Martin (1319 comments)25 June 08
Divvy,
Just add the word “comments” in after the plugin code.
Narendra,
Is it the plugin that you can’t install? Or the trackbacks script?
I’d be surprised if your comments.php file didn’t have the lines I’ve mentioned in the article. It would have to be extremely different not to have them.
Divvy (5 comments)25 June 08
I am really duhhhh lol
Thank you Michael Martin
Divvy (5 comments)25 June 08
Michael Martin, I dont want to abuse of my luck but……..
Can you take a look at the plugin code for me? To find a way to make for example “0 comments” clickable, or in another words, make that as a link like “http://www.domain.com/post title/#comments” or “http://www.domain.com/post title/#respond”.
I really appreciate your help
Michael Martin (1319 comments)25 June 08
Divvy,
Just put the plugin code inside a regular link then.
E.g.
<a href="<?php the_permalink(); ?>/#comments"><?php comment_type_count('comment'); ?> comments</a>Divvy (5 comments)25 June 08
You are the MAN! Thank you so much mate!
RussianMobile.Info (1 comments)24 July 08
This is very intresting!
netslider57 (1 comments)10 August 08
thanks, very nice tips !!
sjl web design (10 comments)13 August 08
Hey very useful tips, I had one blog where I had trackbacks enabled and the comments were huge., so I have just been disabling them since.
Paul Johns (1 comments)26 August 08
Thank you SO much for this post. I tried about 3 different ways before this, 2 of which worked, and none which were standards compliant when there were no trackbacks. This was easy to implement and customize. Thanks!
rap (2 comments)14 September 08
Yay it worked! Thank you!
Arjen (13 comments)30 September 08
Thanks,
It’s a very easy solution, and it looks much better now on my blog!
Firebubble Design (1 comments)2 October 08
Good tutorial was easy to follow and implement.
Sumesh (39 comments)5 October 08
Useful tutorial – I just tested it and works perfectly.
Instead of having a separate trackback area, I used only the code to remove it from the comments loop – I’m done with trackbacks. Rarely do I get genuine trackbacks, in any case (I also removed the RDF-something HTML comment for autodiscovery). I also moved the comment form above the comment loop – I think it would solicit more comments.
Max@Viliat-Blog (2 comments)18 October 08
Thanks for posting this solution, just implemented on my blog – looks great! I always wanted to separate comments from trackbacks…
Max’s last post How To Build Blog Making $100+ a Month on Autopilot Under 3 Weeks – Part 1
Adam Singer (1 comments)28 October 08
I’m thinking of actually removing trackbacks altogether. I think they add clutter – your site looks nice and clean without them. Hmmm….
Joel (3 comments)31 October 08
Thanks! Worked great for my site!
Anna (3 comments)3 November 08
Thank you very much, worked great!
KjgUiuon (1 comments)7 November 08
http://goblenod.net H8jjGFDRlivb54sdREfds
a
Blogshop (1 comments)9 November 08
step by step thank you in mind for if it ever would occur that I would start getting a lot of them
Jo (3 comments)22 November 08
Didn’t think when you wrote this over a year ago someone would still be happy to find it did you? You did? I knew you would
Follow you via RSS and this post was just what I needed. Working on the li factor now to list the Trackbacks, but at least I have them now! Bravo! Thanks
Michael Martin (1319 comments)22 November 08
Jo,
Haha, nope! I had no idea just how popular this post would turn out to be. The fact people are still reading it and implenting it amazes me! One of the most useful I’ve written I guess!
Anil (3 comments)25 November 08
Thanks for posting this solution , worked great!
john - laptop (8 comments)27 November 08
i agree with your opinon. thank you for this post. very intresting. i like it.
Tammie @ Are You For Real? (1 comments)27 November 08
Great tutorial! I used your technique on a couple different blogs, and it worked like a charm for me! Thanks so much for you help.
shoppingbuzZ (1 comments)5 December 08
Nice Tips
Thank you for Share This
tom (10 comments)19 December 08
So Cool Tips, Thank you
smith (1 comments)20 December 08
Thanks very much .. it worked ok.
Rap (2 comments)26 December 08
thanks, very nice tips !!
replica phones (3 comments)29 December 08
Oh, perfect! I learned it
Laurence Flynn (8 comments)7 January 09
Hi Michael,
About time some made a plugin for this (hint hint).
radzio (1 comments)21 March 09
I agree with you.
Hikari (3 comments)6 February 09
tnx for the original tutorial, much apreciated!
Addicott Web (3 comments)10 February 09
That worked like a charm – thanks for putting that together!
Supermance (5 comments)11 February 09
thx for this great tutorial, im gonna test it on my new blog,
WroroPedQuaro (1 comments)11 February 09
fascinating and communicative, but would be suffering with something more on this topic?
Desizntech (1 comments)16 February 09
Nice tips! thanks
debt consolidation (3 comments)16 February 09
This tutorial was exactly what I needed.
These small fixes here and there all around the blog can make such a big difference. This is exactly what I felt about the readability post also man! Wow! simple and thorough!
Charles M. (1 comments)17 February 09
Thank you – nothing like a good trackback in the middle of a comment *conversation* – nice work.
Deepak (4 comments)24 February 09
thanks for this post.I now know what is trackback.
Elvis (1 comments)24 February 09
keep up the good work!
Praveen (1 comments)25 February 09
I don’t know about trackbacks but now i know about trackbacks and there use.Thank you.
Care Egypt (1 comments)21 March 09
i was looking for this
thank you so much
Tomstricks (4 comments)22 March 09
Thanks for this information rich tutorial.This is an asset for newbie bloggers
Nippy (1 comments)27 March 09
I put up my first personal blog yesterday and found this really helpful. Thanks for sharing. Where does everybody get the time?
Design Jar (3 comments)9 April 09
Ive been looking to separate the two for a while now so thanks for creating a post on this subject.
Krish (1 comments)20 April 09
Very nice information. Thanks.
Jan (1 comments)25 April 09
Hello Michael,
first of all great explenation and great overall tutorial structure.
To answere your question, i do use trackbacks because i think it’s a nice and very easy way to get to know the people browsing your site, reading your content and actually finding it helpful.
I do not have many trackbacks on my site but i will definitly change that in future
Again, great article!
Raymond Selda (2 comments)11 May 09
Thank you for putting up this tutorial. Works like a charm in my blog.
Raymond Selda’s Latest Post: Create A Tabbed Content Rotator Using jQuery
pchieng (1 comments)14 May 09
Wow. That worked perfectly! It actually makes the Trackbacks look a lot better on my blog
pchieng’s Latest Post: Lake Miramar Loop 5 Mile Run
baloot (11 comments)18 May 09
I can’t find these code for my Thesis theme..
Another alternative, I must use the plugin.. :p
baloot’s Latest Post: Reezluz Goes Wild. Jom Baca Post Terpilih Di Blog Reezluv (Info Bisnes, Grafik dan Teknologi)
Michael Martin (1319 comments)19 May 09
lol – Good point – You don’t get this level of control over your Thesis theme, or if you did, you’d lose the changes each time you upgraded.
Tom (10 comments)23 May 09
Sorry, stupid question here:
Where is the comments.php file found?
I have found 2 comment.php (no “s”) one in the includes and one in the admin, but I can’t find comments.php (with the “s”)
Neither of the comment.php files have the text I’m supposed to find.
Thanks for any help on this basic question!
Tom
Michael Martin (1319 comments)24 May 09
Hi Tom,
It will be in wp-content/themes/your-theme-name . That’s the folder that contains all your theme files. If you ever need to edit anything to do with your design, it will be in one of the folders in there!
You never edit the files in wp-admin or wp-includes because your changes would be overwritten when you next upgrade WordPress.
Tom (10 comments)24 May 09
Thanks Michael! I really appreciate the quick response!
Michael Martin (1319 comments)25 May 09
Welcome, good luck now!
slim b (1 comments)3 June 09
nice! thanks
Ben (18 comments)5 June 09
Thanks, I used one of your trackbacks to work out how to put it before the comments
Ben’s Latest Post: Windows Update Won’t Work After Updating to Service Pack 3
Ivy (1 comments)15 June 09
Thanks for this, it helps wonders! Now to fix up the CSS.
.-= Ivy´s last blog ..Beautiful British Columbia =-.
tatil (1 comments)18 June 09
thank you very good …
.-= tatil´s last blog ..Çeşme Otel Yeni =-.
Accura Cast (1 comments)9 July 09
That is some beautiful code!
Thanks ever so much
.-= Accura Cast´s last blog ..Google Annihilates Microsoft, Yahoo! In Mobile =-.
harryandlou (1 comments)15 July 09
Thank you very much for this! Very, very helpful.
Gustavo (1 comments)22 July 09
Thank you for the very usefull code !
.-= Gustavo´s last blog ..Como usar trackbacks e personalizar comentários no wordpress =-.
rap dinle (1 comments)22 July 09
im gonna test it on my new blog
thanks
Scrooby (1 comments)27 July 09
Thanks for sharing! I’ve been looking to implement this onto my blog for a while now but never bothered, now after stumbling across this post, I have added it and it’s great! Such a simple method of making your blog look so much better. Thanks!
maskoko (3 comments)29 July 09
thats’s right..!
.-= maskoko´s last blog ..Bikin Abi malu wae.. =-.
Sérgio Soares (1 comments)11 August 09
Well done.
Very good tip
Thanks
salenco (1 comments)15 August 09
Nice tutorial but I have a problem: I can´t find in comments.php. I´m using Wordpress 2.8.4 with the last Cutline template with one right column.
I´d like a lot to separate comments and trackbacks, please tell me how I can do it.
Thanks for reading.
Imran (1 comments)16 August 09
I guess this does not work anymore. Because WP 2.8+ has removed the loop with wp_list_comments()
You either need to define your own comment listing function or edit comment_templates.php in wp-includes folder
Joe (5 comments)19 August 09
I just added the code to my comments file. Works great.
I had to add some css padding to get the trackbacks in line with the title -mostly specific to my theme though.
Thanks much.
abipiella (1 comments)24 August 09
ouye mobility radeon hd 3470 driver :\ zti
kepoj conexant modem driver =(( pkq
yrgrz ageia physx driver ? tek
fbwih kx audio driver :#() hdgu
Avery (11 comments)31 August 09
Personally,I like php,but I never mind to put trackbacks and comments together.The key point is content.So I just focus on the content.
dnmtnk (1 comments)10 September 09
Thanks for sharing! I’ve been looking to implement this onto my blog for a while now but never bothered, now after stumbling across this post, I have added it and it’s great! Such a simple method of making your blog look so much better. Thanks!
Street.Walker (1 comments)15 September 09
In WP 2.8.x i try using this:
wp_list_comments(‘type=comment’); <= for comment
wp_list_comments('type=ping'); <= for pingback
just in 2 lines code, more simple
Sooran (2 comments)15 September 09
tancks.
This Post Helped me
Good Time
Fandi gala (1 comments)27 September 09
Tentu saja akan menjadi semakin
lynnscott (20 comments)29 September 09
Great Post….I will down load and let you know ….I value you’re information…Thanks..
Ezuca (1 comments)3 October 09
Thanks for this cool tutorial. I have been searching the net for this but only got those for the older versions of WP. Thanks again.
Lucrative Investing (5 comments)3 October 09
You can also use a tab element to separate the comments and trackbacks in another way if you wish. This would just be a different visual way to separate it. I found that some people really like tabs(myself for one). Tabs helps to consolidate a lot of information into on small area if space is an issue.
Roy61 (1 comments)22 October 09
Ask how long the benefits will last. ,
Robomaster (23 comments)23 October 09
Great tutorial! Yup, it gets really annoying when there’s a bunch of comments and then a trackback sitting in between them.
Boy69 (1 comments)23 October 09
Were physicians to use this same logic they would end up in the lawyer’s office every day. ,
sticker printing (9 comments)28 October 09
I always wonder about track backs, i always use it but never study the original purpose and advantage a track back can give separately from the comment that we use to simply convey a message to the post opener about how we get the post and how much we liked it and other stuff, anyone help me telling something about track backs.
Paul Olyslager (1 comments)29 October 09
It would be great to exclude the trackbacks from the comment count as well
Blaine Bullman (5 comments)3 November 09
This will come in very handy when im designing a new skin for my blog.
I do use trackbacks on my blog but I never actually put much thought into why but I guess if someone is nice enough to link to me, I want to be nice and trackback.
iPhone Application Testing (2 comments)10 November 09
Nice coding… thanks for making life simple…
Mezanul (4 comments)11 November 09
Thanks Michael, it helped me a lot.. I have now a more cleaner page with the comments neatly separated from the trackbacks.
Umar (2 comments)27 November 09
Hi,
Nice howto, its work great.
Thanks
Kimberley (1 comments)28 December 09
Thank you so much for this! I thought you explained things very well. A lot of bloggers assume everyone knows a lot about coding and things, and don’t take the time to explain exactly where to put things, but your instructions were very simple and exact and made things very easy, even for those of us who are still learning! Again, thank you!
Autai ptfe (17 comments)30 December 09
Great Poster !!
Dennis (7 comments)12 January 10
This saved me alot of time, good post!
Greg London (3 comments)15 January 10
I do use trackbacks on my site, this post is very useful.
I’m going to start going into my comment.php file and setting this up right away.
Yuriness - Yuri and Shoujo-ai (4 comments)16 January 10
Thanks! I was using IntenseDebate and I thought it wouldn’t work there, but now I quit ID system so I’ll try it out
Yuriness - Yuri and Shoujo-ai (4 comments)16 January 10
Erm, I just went to try it, but the only code you told to search that I found in my comments is “”
I don’t have “” and
Yuriness - Yuri and Shoujo-ai (4 comments)16 January 10
lol, it doesn’t show between “”. I mean I only have: in my comment, I don’t have the other two parts of the code.
Please, delete my others comments, sorry about that
Custom Stickers (4 comments)18 January 10
Really great blog thanks for share information.
Anna (3 comments)19 January 10
Thanks for this. I just implemented this on my blog.
Texas Medical Transcriptioniption (11 comments)21 January 10
Writing a trackback thing that integrates pretty interesting I think.
Ripped From The Crypt (1 comments)22 January 10
I love the fact that people like you take the time to explain things so clearly and simply. @ minutes work and all my comments are now sooo much tidier!
cheers dude!
Frucomerci (1 comments)26 January 10
Very useful! I’ve just implemented it! Thank you very much for sharing!
Kaplang (1 comments)26 January 10
This is just what I need
thanks
sikiş (2 comments)30 January 10
Personally,I like php,but I never mind to put trackbacks and comments together.The key point is content.So I just focus on the content.
Infographiste (1 comments)30 January 10
Thanks for the tuto mate I’ve just implemented this on the blog of one of my customers and it worked like a charm. So thanks again for sharing and have a nice week end
A.P. Scanner (1 comments)5 February 10
Depending on the type of post I make, I sometimes uncheck the ‘trackback’ checkbox. I found that some blogs have this separation feature already built-in in their themes. Some themes unfortunately lack this. Good tutorial. Thanks
glasgow (1 comments)15 February 10
helpfull info , i have implemented this on my template on theme forrest
thanks
Man Van Richmond (19 comments)17 February 10
I just wonder what is the use of having a track back in a blog.
Yeah, it is better if there are no disruption in the comments area so that commenter can have a good view of the comments and can contribute well on the discussion.
sikis izle (1 comments)22 February 10
Thanks for this. I just implemented this on my blog.
rap indir (1 comments)24 February 10
thank you
m65 (19 comments)27 February 10
i dont think any other blog software will be able to come in and beat wordpress
Debjit (2 comments)7 March 10
Hey! Thanks for this. I have a suggestion to add. Some themes do not have the line ($comments as $comment) in them as they use some other format of the theme core files. Here is how it can be worked around, to get only the trackbacks. The simplest way is to include this:
Debjit (2 comments)7 March 10
//PHP start
wp_list_comments(‘type=pings’);
//PHP End
submit link free (3 comments)9 March 10
Yeah, these codes can help me a lot, I have to say, it’s very useful for solving some question.
julian (1 comments)12 March 10
i have read this, i will try in my blog..
thanks
sikiş (2 comments)12 March 10
Thanks for this. I just implemented this on my blog.