Wordpress - Custom Comments Template


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



Copy this code and paste it in your HTML
  1. -------------------------------
  2. Comments.php
  3. -------------------------------
  4.  
  5. <ul class="commentlist">
  6. <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
  7. </ul>
  8.  
  9. -------------------------------
  10. Functions.php
  11. -------------------------------
  12.  
  13. <?php function mytheme_comment($comment, $args, $depth) {
  14. $GLOBALS['comment'] = $comment; ?>
  15. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
  16. <div id="comment-<?php comment_ID(); ?>">
  17. <?php if ($comment->comment_approved == '0') : ?>
  18. <?php _e('Your comment is awaiting moderation.') ?><br /><br />
  19. <?php endif; ?>
  20. <strong><?php printf(__('%1$s'), get_comment_date('d.j.y')) ?> | <?php printf(__('%s'), get_comment_author_link()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></strong><br />
  21. <?php comment_text() ?>
  22.  
  23. <div class="reply">
  24. <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
  25. </div>
  26. </div>
  27. <?php
  28. }
  29. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.