Better WordPress Comments


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. function better_comments($comment, $args, $depth) {
  3. $GLOBALS['comment'] = $comment;
  4. ?>
  5. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  6. <div id="comment-<?php comment_ID(); ?>" class="comment-body">
  7. <div class="comment-body-inner">
  8. <div class="comment-avatar">
  9. <?php echo get_avatar($comment, $size = '45', $default = get_bloginfo('stylesheet_directory').'/images/default-avatar.png' ); ?>
  10. </div>
  11. <!-- END avatar -->
  12. <div class="comment-author vcard">
  13. <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
  14. </div>
  15. <!-- END comment-author vcard -->
  16. <?php if ($comment->comment_approved == '0') : ?>
  17. <em><?php _e('Your comment is awaiting moderation.') ?></em>
  18. <br />
  19. <?php endif; ?>
  20.  
  21. <div class="comment-meta commentmetadata">
  22. <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a>
  23. <?php edit_comment_link(__('(Edit)'),' ','') ?>
  24. </div>
  25. <!-- END comment-meta commentmetadata -->
  26.  
  27. <?php comment_text() ?>
  28.  
  29. <div class="reply">
  30. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  31. </div>
  32. <!-- END reply -->
  33. </div>
  34. <!-- END comment-body-inner -->
  35. </div>
  36. <!-- END comment -->
  37. <?php
  38. }
  39. ?>

URL: http://www.wpexplorer.com/blog/better-wordpress-comments.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.