I wanted to make some changes to the code WordPress spits out for comments. This included:
- changing the date format
- removing comment author links
- removing the class ‘vcard’ (it’s an old structured data format)
Your reasons for changing the WordPress comments format will probably be different to mine but the solution is still the same. Hopefully this quick tutorial will help.
How to customise comments
Open the comments.php file in your theme and replace:
wp_list_comments();
With:
wp_list_comments('callback=mytheme_comment);
This will replace the default function for displaying comments. Go to your functions.php file and add the following:
// Custom comments
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="comment-author">
<?php echo get_avatar( $comment, 56 ); ?>
<?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author()) ?>
</div>
<div class="comment-moderation">
<?php if ($comment->comment_approved == '0') : ?>
<p><?php _e('Your comment is awaiting moderation.') ?></p>
<?php endif; ?>
</div>
<div class="comment-meta commentmetadata">
<p ><?php printf(__('%1$s at %2$s'), get_comment_date('j F, Y'), get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></p>
</div>
<div class="user-comment">
<?php comment_text() ?>
</div>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
</div>
<?php }
Note the lack of a trailing </li>. In order to accommodate nested replies, WordPress will add the appropriate closing tag after listing any child elements so there is no need to add one.
You can find more info on the comments callback function from the WordPress codex website. I also found this older post on Deluxe Blog Tips incredibly useful.

9 November, 2019 at 12:36 pm
Thank you! Just the information and examples that I need.
3 October, 2023 at 10:45 pm
I can’t seem to get depth level to work. Every comment comes back at depth 1/
21 June, 2025 at 8:43 am
Tell to me, please – where I can find more information on this question?