How to separate trackbacks from comments isn't a new trick, but when WordPress released version 2.7, they introduced a revamped new comment system that included threaded comments, pagination capability, and much more. But along with this change, many parameters of the core file also changed. In this article, we will show you how you can separate trackbacks from comments in WordPress. This hack will only work for version 2.7+ and if you are not using it you should start now due to the recent MySQL attack on older versions.
We found this tutorial on one of the WordPress developer websites called Sivel.net
Here's an example of the new loop we'll be referring to in the tutorial:
a% u201C% u201D
comment_status):?>
los comentarios están cerrados.
Find this code in your comments.php :
Directly below this code add the following code:
[/ php Una vez que haya agregado el código anterior, encuentre este código:
Replace the above code with the following code:
Now, as you see in our example loop, there is code for the sorted list that looks like
Directly below this code add:
Now adding the endif tag, if you don't have any comments, the sorted list won't be displayed. Now we are going to add the pings to the comments.
Add the following code below or however you want to display it. Pings will be displayed.
Trackbacks / Pingbacks
Now when you have this it will show the trackbacks but it will show them as comments. Now you may want to display them as a list because otherwise you're just wasting space. So here is how you can do that.
Simply open functions.php which is in your theme folder and add the following function there:
This feature will allow you to display pings as a list instead of displaying them as a comment. But you have to do one more thing..
Open your comments.php and find this code:
Replace it with:
Now the final copy of the example loop would look like this:
a% u201C% u201D
Trackbacks / Pingbacks
comment_status):?>
los comentarios están cerrados.
Now that you're done. There is a bonus hack that you can use. Since you're showing them separately, it would be nice if it shows the accurate comment count when excluding trackbacks and pings. Use this tutorial we wrote to display the most accurate comment count in WordPress.