+ Reply to Thread
Results 1 to 1 of 1
-
07-22-2009 01:00 PM #1
- Join Date
- Jul 2009
- Location
- United Kingdom
- Posts
- 489
- Downloads
- 0
- Uploads
- 17
- Blog Entries
- 2
Separate Wordpress Comments and Trackbacks
First of all lets define for those of you the term: Trackback. Trackback is a way to notify a website when you publish an entry that references it.
When you send it a trackback, a link with a short excerpt of your entry will appear on the referenced website.
Separating your trackbacks and comments requires a minimum coding work to do. First of all please make a backup of your comments.php file just in case something goes wrong.
Here we go:
1 ) Access your comments.php file and locate the following code:
<?php foreach ($comments as $comment) : ?>
Immediately after the above code, you’ll want to place this code:
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == 'comment') { ?>
2 ) If you scroll down a little bit you will locate the following code:
<?php endforeach; /* end for each comment */ ?>
This will filter out all of the trackbacks and pingbacks from your main comments loop. Now we need to create a second comments loop to display the trackbacks and pingbacks.
3 ) Almost immediately below the code from step 2 you should find this code:
<?php else : // this is displayed if there are no comments so far ?>
Immediately before the above code, you’ll want to 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>


LinkBack URL
About LinkBacks


Reply With Quote



Bookmarks