[wp-hackers] Separating Pings from Comments in WordPress 2.7
Ryan Boren
ryan at boren.nu
Mon Oct 6 16:26:09 GMT 2008
On Mon, Oct 6, 2008 at 6:32 AM, Matthew Martz <matt at sivel.net> wrote:
> I've been working on writing up a how to on separating pings from comments
> in WordPress 2.7 for the past few days. I finally decided to publish it and
> figured some of you may find it useful.
>
> http://sivel.net/2008/10/wp-27-comment-separation/
You can customize your li output by registering a callback. The
callback should not output the closing li tag, the walker will do
that. With a callback you don't have to do your own loop and you
don't have to handle threading yourself. Also, I'm think of adding a
separate_comments boolean to comments_template() so themes can
indicate they want comments separated with counts for each type.
wp_list_comments(array('callback' => 'custom_comment'));
function custom_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID( ); ?>">
<?php echo get_avatar( $comment->user_id,
$comment->comment_author_email, 32 ); ?>
<h4>
<?php comment_author_link( ); ?>
<span class="meta"><?php comment_time( ); ?> on <?php
comment_date( ); ?> | <a href="#comment-<?php comment_ID( ); ?>">#</a>
| <?php echo comment_reply_link(array('depth' => $depth, 'max_depth'
=> $args['depth'])) ?><?php edit_comment_link( __( 'e' ),
' | ',''); ?></span>
</h4>
<?php comment_text( ); ?>
<?php
}
More information about the wp-hackers
mailing list