/home/moonrcjl/wptheme.moontelict.com/transko/wp-content/themes/transko/comments.php
<?php
// Check if comments are allowed
if (comments_open()) :
?>
<div id="comments" class="comment-form-wrap pt-5">
<?php
// Display the comments list
if (have_comments()) :
?>
<div class="comments-heading">
<h3>
<?php
$comment_count = get_comments_number();
echo esc_html($comment_count) . ' ' . _n('Comment', 'Comments', $comment_count, 'transko');
?>
</h3>
</div>
<ul class="omments-area">
<?php
wp_list_comments(array(
'style' => 'ul',
'short_ping' => true,
'callback' => 'custom_comment_list'
));
?>
</ul>
<?php
// Display comment pagination if needed
the_comments_pagination(array(
'prev_text' => esc_html__('Previous', 'transko'),
'next_text' => esc_html__('Next', 'transko'),
));
endif;
if ( is_user_logged_in() ) {
$cl = 'loginformuser';
} else {
$cl = '';
}
$commenter = wp_get_current_commenter();
$req = get_option('require_name_email');
$fields = array(
'author' => '<div class="row g-4"><div class="col-lg-6"><div class="form-clt">
<span>' . esc_attr__('Your Name*', 'transko') . '</span>
<input type="text" name="author" id="author" placeholder="' . esc_attr__('Your Name', 'transko') . '" value="' . esc_attr($commenter['comment_author']) . '" ' . ($req ? 'required' : '') . '></div>
</div>',
'email' => '<div class="col-lg-6">
<div class="form-clt">
<span>' . esc_attr__('Your Email*', 'transko') . '</span>
<input type="email" name="email" id="email" placeholder="' . esc_attr__('Your Email', 'transko') . '" value="' . esc_attr($commenter['comment_author_email']) . '" ' . ($req ? 'required' : '') . '>
</div>
</div>',
'url' => '<div class="col-lg-12">
<div class="form-clt">
<span>' . esc_attr__('Your Website', 'transko') . '</span>
<input type="text" name="url" id="url" placeholder="' . esc_attr__('Your Website', 'transko') . '" value="' . esc_attr($commenter['comment_author_url']) . '">
</div>
</div></div>',
);
$defaults = [
'fields' => $fields,
'comment_field' => '<div class="col-xxl-12 pb-4' . $cl . '">
<div class="form-clt">
<span>' . esc_attr__('Your Comment', 'transko') . '</span>
<textarea id="comment" name="comment" placeholder="' . esc_attr__('Your Comment Here...', 'transko') . '" required></textarea>
</div>
</div>
',
'submit_button' => '<div class="col-lg-6">
<div class="postbox__comment-btn">
<button type="submit" class="theme-btn">' . esc_html__('Submit Comment', 'transko') . '<i class="fa-solid fa-arrow-right-long"></i></button>
</div>
</div>',
'cookies' => '<div class="col-xxl-12">
<div class="postbox__comment-agree d-flex align-items-start mb-25">' .
'<input class="e-check-input" type="checkbox" id="e-agree" name="wp-comment-agree" value="1" checked>' .
'<label class="e-check-label" for="e-agree">' . esc_html__('Save my name, email, and website in this browser for the next time I comment.', 'transko') . '</label></div>
</div>'
];
// Display the comment form
comment_form($defaults);
?>
</div><!-- .comments-area -->
<?php endif; ?>
<?php
// custom_comment_list
function custom_comment_list($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
if ($comment->comment_type == 'pingback' || $comment->comment_type == 'trackback') {
// Display pingbacks and trackbacks differently if needed
?>
<li class="pingback">
<p><?php esc_html_e('Pingback:', 'transko'); ?> <?php comment_author_link(); ?></p>
</li>
<?php
} else {
// Display regular comments
?>
<li <?php comment_class('comment'); ?> id="comment-<?php comment_ID(); ?>">
<div class="blog-single-comment gap-4 pt-4 pb-5">
<div class="image">
<?php echo get_avatar($comment, 80); ?>
</div>
<div class="content">
<div class="head d-flex flex-wrap gap-2 align-items-center justify-content-between">
<div class="con">
<h5><?php comment_author(); ?></h5>
<span><?php comment_date(); ?></span>
</div>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<p class="mt-30 mb-4"><?php esc_html_e('Your comment is awaiting moderation.', 'transko'); ?></p>
<?php endif; ?>
<?php comment_text(); ?>
<div class="postbox__comment-reply reply">
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
</div>
</div>
</div>
<?php
}
}