[wp-hackers] Separating Pingbacks and Trackbacks from Comments

Mark Jaquith mark.wordpress at txfx.net
Wed Jun 15 03:08:14 GMT 2005


Scott Merrill wrote:

> Chris' "Seperation Anxiety" plugin is a good start for this:
> http://dev.wp-plugins.org/file/anxiety/trunk/cjd_anxiety.php
>
> And I know Chris, Mark Jaquith and I collaborated on a slightly 
> modified version, for which I cannot find the permalink...

http://txfx.net/files/wordpress/ping-track-comment-count.phps

Use as follows:

<?php comment_type_count('comment'); ?> Regular comments only
<?php comment_type_count('ping'); ?> Pings and Trackbacks combined
<?php comment_type_count('trackback'); ?> Trackbacks only
<?php comment_type_count('pingback'); ?> Pingbacks only
<?php comment_type_count('all'); ?> All types (default)

There is also <?php get_comment_type_count('all'); ?> which returns, 
instead of echoes (following standard WP convention).

Both can also take an optional post ID as a second argument.  By default 
it uses the ID of the current post in the loop.

The plugin uses a "smart" cache that'll populate itself the first time 
you use the function on a page load.  All subsequent requests will come 
from the cache and not use up any MySQL queries.

I'll put up a page for this later tonight:  it'll be under 
http://txfx.net/code/wordpress/

Thanks to Skippy for reminding me of this... someone will probably find 
this useful.

- Mark


More information about the wp-hackers mailing list