Current Version: .9
About:
This plugin provide useful template functions to separate trackbacks and pingbacks from comments. Enhanced version of Thomas Au (MK)’s Trackping Seperator. There are still some bugs to work out. If anyone has any ideas on how to fix the comment, trackback, and pingback count call so it will properly call the number parameter, I’d be greatly appreciative to find out how it’s done.
Installation Instructions:
- Download Trackback/Pingback Separator Enhanced
- Rename the file to trackpingsep.php.
- Drop the file into your wp-content/plugins/ directory
- Open your WordPress Admin Panel and go to the Plugins tab.
- Activate the plugin
You’ll now want to modify your comment calls so you can separate out trackbacks, pingbacks and comments from each other. These calls are usually found in the archive.php, index.php (main loop), and search.php files in your template. You’ll also want to modify your comments.php (and possibly your comments-popup.php) so you can separate your comments out. Some sample code will follow.
Template Tags:
- comments_only_popup_link(zero, one, many, number) – This works as the comments_number() template tag does. (Note: The number call is currently not working properly)
- zero (string) – Displayed when there are no comments. Default: No Comments
- one (string) – Displayed when there is one comment. Default: 1 Comment
- many (string) – Displayed when there is more than one comment. % is used in the string to identify the variable numbers of comments. Default: % Comments
- number (integer) – Not working. Limits the number of comments to display. Default: Display all
Example:
<?php comments_only_popup_link(’No Responses’, ‘1 Response’, ‘% Responses’); ?>
- trackpings(param, type, zero, one, many, number) – This is the core of the code. This shows either the actual trackbacks, the actual pingbacks, or the counts of each or both.
- param (string) – can be set as null or count. If count, then it will display a count of trackbacks, pingbacks or both depending on subsequent parameters. Default: null
- type (string) – can be set as trackback, pingback, or both. This tells the function to display or count either trackbacks, pingbacks, or both. Default: both
- zero (string) – For count only. Displays customized return text. Default: No Trackbacks/Pingbacks
- one (string) – For count only. Displays customized return text. Default: 1 Trackback/Pingback
- many (string) – For count only. Displays customized return text. Use % to represent the variable number place. Default: % Trackbacks/Pingbacks
Example:
// Cycles through the trackbacks and displays ONLY trackbacks. Displays everything nice.
// To do for both trackbacks & pingbacks replace the ‘trackback’ calls in the
// trackping function with ‘pingback’ or ‘both’.<?php if ($trackbacks = trackpings(”,’trackback’)) : ?>
<a name=”trackback” id=”trackback”></a>
<h3 id=”comments”><?php trackpings(’count’,'trackback’,'No Trackbacks Logged’,'One Trackback Logged’,'% Trackbacks Logged’); ?> to “
<?php the_title(); ?>”</h3>
<?php foreach ($trackbacks as $trackback) : ?>
<cite><a href=”<?php echo $trackback->comment_author_url; ?>”> <?php echo $trackback->comment_author; ?> </a></cite>
<?php comment_type(’say’, ‘trackback’, ‘ping’) ?>s:
<?php if ($comment->comment_approved == ‘0′) : ?><em>Your comment is awaiting moderation.</em><?php endif; ?>
<br />
<small><a href=”#comment-<?php comment_ID() ?>” title=”"><?php comment_date(’F jS, Y’) ?> at <?php comment_time() ?></a>
<?php edit_comment_link(’(edit)’,”,”); ?></small><p />
<?php comment_text() ?>
<?php endforeach; ?>
<?php endif; ?>
