Displaying pingbacks to your post is a good thing because your readers often will find interesting and value added information in the post that links to your post. What I don’t like is when pingbacks get mixed with the comments to your post, I find that messy. Therefore I decided to separate the pingbacks from my comments and in this post I will show you how I did it.
I guess that some WordPress themes already have this functionality, but mine did not so I decided to implement this by my self.
First I changed the post summary heading to count comments and pingbacks separately. Originally it counted both comments and pingbacks and displayed it as “x comments”. By implementing the following code “x comments and x pingbacks” will be displayed.
Insert the following code in the have_posts() loop in index.php
<div class="post" id="post-<?php the_ID(); ?>">
<div class="date"><span><?php the_time('M') ?>
</span> <?php the_time('d') ?></div>
<div class="title">
<h2 class="posttitle">
<a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a></h2>
<span id="more-942"></span>
<div class="postdata">
<span class="category"><?php the_category(', ') ?></span>
<span class="comments">
<a href="<?php the_permalink() ?>#comments">
<?php fb_comment_type_count( 'comment' ); ?> and
<?php fb_comment_type_count
( 'pings', 'No Pingbacks', '1 Pingback', '% Pingbacks' ); ?>
</a></span>
</div>
</div>
This will create the whole header that you see for each post on my blog

Now we need to separate the pingbacks from the comments in the post, I decided to first display all comments then display the pingbacks.
Insert in the comment loop in comments.php
<?php if ( empty($comments_by_type['comment']) ) { ?>
<h3 id="comments">
<?php fb_comment_type_count( 'comment' ); ?>
to “<?php the_title(); ?>”</h3>
<ol class="commentlist">
<?php wp_list_comments( 'type=comment' ); ?>
</ol>
<?php } ?>
<?php if ( empty($comments_by_type['pings']) ) { ?>
<h3 id="comments">
<?php fb_comment_type_count
( 'pings', 'No Pingbacks', '1 Pingback', '% Pingbacks' ); ?>
to “<?php the_title(); ?>”</h3>
<ol class="commentlist">
<?php wp_list_comments( 'type=pings' ); ?>
</ol>
<?php } ?>
By doing so you have successfully separated the pingbacks from your comments

So to achieve this you only need to insert a few lines of code in two .php files
I think this is the beauty of WordPress: Very easy to modify just the way you like it. All you need is to know some html and php. If you want to know more about the WordPress php functions you can read about it at WordPress.org Function Reference












