// Add extra field to comment form
function add_bcw_fields($fields){
$fields[\'test\'] = \'<input type="text" name="test" id="test" size="22" />\';
return $fields;
}
add_filter( \'comment_form_default_fields\', \'add_bcw_fields\' );
//Save the extra comment field value
function bcw_handle_comment($id) {
if (array_key_exists(\'test\', $_POST))
update_comment_meta( $id, \'bcw_test\', $_POST[\'test\']);
}
add_action(\'wp_insert_comment\', \'bcw_handle_comment\');
//Override default theme function to display a comment
function twentyten_comment( $comment, $args, $depth ) {
$GLOBALS[\'comment\'] = $comment;
switch ( $comment->comment_type ) :
case \'\' :
?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, 40 ); ?>
<?php printf( __( \'%s <span class="says">says:</span>\', \'twentyten\' ), sprintf( \'<cite class="fn">%s</cite>\', get_comment_author_link() ) ); ?>
</div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == \'0\' ) : ?>
<em class="comment-awaiting-moderation"><?php _e( \'Your comment is awaiting moderation.\', \'twentyten\' ); ?></em>
<br />
<?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php
/* translators: 1: date, 2: time */
printf( __( \'%1$s at %2$s\', \'twentyten\' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( \'(Edit)\', \'twentyten\' ), \' \' );
?>
</div><!-- .comment-meta .commentmetadata -->
<div class="comment-body"><?php comment_text(); ?></div>
<?php echo get_comment_meta( $comment->comment_ID, \'bcw_test\', true ); ?>
<div class="reply">
<?php /* <?php comment_reply_link( array_merge( $args, array( \'depth\' => $depth, \'max_depth\' => $args[\'max_depth\'] ) ) ); ?> */ ?>
</div><!-- .reply -->
</div><!-- #comment-## -->
<?php
break;
case \'pingback\' :
case \'trackback\' :
?>
<li class="post pingback">
<p><?php _e( \'Pingback:\', \'twentyten\' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( \'(Edit)\', \'twentyten\' ), \' \' ); ?></p>
<?php
break;
endswitch;
}
endif;