Trackping Separator, by its name, is a WordPress Plugin that could separate trackbacks/pingbacks from user comments. Useful functions to list trackbacks are provided, but it requires heavy modification on the theme.
As this is my first plugin, there may exists bugs and may be harmful to your WP. So if you have encountered any problems please contact me ASAP by sending mk [dot] is [dot] here [at] gmail [dot] com or leave me a comment on my blog's TSP page. Thanks and enjoy!
(And sorry, it's nothing related to Traveling Salesperson)
Attention: I had carelessly break the TSP plugin available for download. Thanks to Edrei Zahari who reports to me that it doesn't work, I fixed the file and it should have no problem at all. Sorry for the inconveniences caused.
Trackping Separator 1.1.1 is out! Updates include an addition of %date parameter to listtrackback(), and WordPress 2.1 compatible (updated a few SQLs). Update is recommended.
Download Trackping Separator.
After activated your plugin, edit your template as follows:
comments_popup_link, and change it into comments_only_popup_link. The link will print out the number of comments only, not including trackbacks/pingbacks.comments_popup_link (remember it's outside from the <?php ?> tags):<a href="<?php the_permalink() ?>#trackback" title="Trackback" class="trackbacklink"> <?php echo trackpings('count'); ?> Trackback/Pingback</a>
The output would be something similar to the one down below. This tag is quite similar to comments_popup_link(). The first 4 parameters are the same, you could look at the description here. The difference is that this has an extra one, which decides whether number of total trackbacks and pingbacks (default), only trackbacks, or only pingpacks are shown.
The old loop is gone, and the tag to replace it is:
<?php listtrackpings(); ?>
There are 2 parameters for this tag: The first is the type of links the tag would show. It could be either 'trackback' or 'pingback'. Leaving it empty would return both. So
<?php listtrackpings('trackback'); ?>
would show a list of trackbacks, and
<?php listtrackpings('pingback'); ?>
would show a list of pingbacks.
The second parameter is a little bit more complex. The pattern parameter is used to define how links are shown. In fact it is some HTML with defined variables. Let's take a look with the default value:
<li id="trackback-%id"><a href="%url">%origin</a><br />%content</li>
You should notice there are some percentage sign, right? Those are the tags that are going to be replaced with loop variables. I'll explain them one by one:
For common folks, this piece of code should works for you:
<h2>Trackbacks/Pingbacks</h2> <ul><?php listtrackpings(); ?></ul>
NEW There's a third parameter that user could specify the format of the date string. For reference, please visit WordPress Codex.
Oh, and by the way, if you wish to show the number of trackback/pingback of that post, use the following tag:
<?php echo trackpings('count'); ?>
And the final one would look like this:
<h2><?php echo trackpings('count'); ?> Trackbacks/Pingbacks</h2> <ul><?php listtrackpings(); ?></ul>
Identify the comment loop in your comment.php.
Before:
<?php foreach ($comments as $comment) : ?> ... <?php endforeach; ?>
After:
<?php foreach ($comments as $comment) : ?> <font color="red"><?php if (get_comment_type() == 'comment') : ?></font> ... <font color="red"><?php endif; ?></font> <?php endforeach; ?>
Text in <font color=“red”>red</font> are the lines need to be added by yourself.
Expecting more steps? Sorry to disappoint you. Maybe move to your page and have a check to see if things works, alright?
Q:How can I display the number of comments and number of trackback/pingbacks?
A:To display number of comments only, paste the following code:
<?php comments_only_number('0', '1', '%'); ?>
To display trackback/pingbacks only, paste the following:
<?php echo trackpings('count'); ?>
Q:How can I display the date for each trackback/pingback?
A:Use the variable %date in listtrackback() template function. There's an extra parameter for the function to specify the date format. For example, if you want to display the date in the trackping loop, the function call should be:
<pre><?php listtrackpings('', '<li id="trackback-%id"><a href="%url">%origin</a>(%date)<br />%content</li>'); ?></pre>
(Don’t ever ask me where are 1.0.3 to 1.0.5! They are long gone! :P )