Hi All,
If you want to use the like dislike counter button with your comment section you have to use wp_list_comments like this instead simple wp_list_comments:
<?php wp_list_comments('type=comment&callback=my_custom_comments'); ?>
In this we are using callback to show comment list. In particular we are using my_custom_comments as my callback function. And in this callback function we can use like dislike button code. Here I have used the template code for like dislike buttons below <?php comment_text() ?>
In functions.php use below function:
function my_custom_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
<<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
<?php if ( 'div' != $args['style'] ) : ?>
<div id="comment-body-top"></div>
<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
<?php endif; ?>
<div class="comment-author vcard">
<?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, 50 ); ?>
<?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
</div>
<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php
/* translators: 1: date, 2: time */
printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),' ','' );
?>
</div>
<div class="comment_txt"> <?php comment_text() ?> </div>
<!-- here to copy and paste like dislike button functions -->
<?php
if(function_exists('like_counter_c')) { like_counter_c("text for like"); }
if(function_exists('dislike_counter_c')) { dislike_counter_c("text for dislike"); }
?>
<!-- here to copy and paste like dislike button functions -->
<?php if ($comment->comment_approved == '0') : ?>
<em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
<?php endif; ?>
<div class="reply">
<?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
</div>
<div id="comment-body-bottom"></div>
<?php endif; ?>
<?php
}
?>
You can refer Function Reference/wp list comments
cheers ??