File: /mnt/data/smarthr-co-in/wp-content/themes/dreamslanding/comments.php
<?php if (post_password_required()) return; ?>
<?php
if (!function_exists('dreamstour_modern_comment')) {
function dreamstour_modern_comment($comment, $args, $depth) {
$tag = ($args['style'] === 'div') ? 'div' : 'li';
$author_id = $comment->user_id;
$avatar = get_avatar($comment, 48, '', '', array('class' => 'img-fluid rounded-circle avatar avatar-md me-2'));
$author_name = get_comment_author($comment);
$comment_time_human = human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ' . esc_html__('ago', 'dreamstour');
echo '<' . esc_html($tag) . ' id="comment-' . esc_attr(get_comment_ID()) . '" class="my-3">';
echo '<div class="border border-light rounded p-3">';
echo '<div class="d-flex align-items-center justify-content-between mb-3">';
echo '<div class="d-flex align-items-center">';
echo wp_kses_post($avatar);
echo '<div><h6 class="mb-0">' . esc_html($author_name) . '</h6><span class="fs-14 fw-normal text-gray-6">' . esc_html($comment_time_human) . '</span></div>';
echo '</div>';
echo '<div>';
comment_reply_link(array_merge($args, array(
'reply_text' => '<span class="fs-14 fw-medium text-dark d-flex align-items-center"><i class="isax isax-back-square me-1"></i> ' . esc_html__('Reply', 'dreamstour') . '</span>',
'depth' => $depth,
'max_depth' => $args['max_depth'],
)));
echo '</div>';
echo '</div>';
echo '<div class="flex-grow-1">';
if ($comment->comment_approved == '0') {
echo '<p><em>' . esc_html__('Your comment is awaiting moderation.', 'dreamstour') . '</em></p>';
}
echo '<p class="fs-14 text-gray-6">' . esc_html(get_comment_text($comment)) . '</p>';
echo '</div>';
echo '</div>';
echo '</' . esc_html($tag) . '>';
}
}
?>
<?php if (have_comments()) { ?>
<h5 class="mb-3"><?php echo esc_html__('Comments','dreamstour'); ?> <span>(<?php printf( number_format_i18n( get_comments_number() ) ); ?>)</span></h5>
<div class="review-sec mb-0">
<ul class="commentlists ">
<?php wp_list_comments('callback=dreamstour_theme_comment'); ?>
</ul>
<?php
if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<footer class="navigation comment-navigation" role="navigation">
<div class="nav_comment_text"><?php echo esc_html__( 'Comment navigation','dreamstour' ); ?></div>
<div class="previous"><?php previous_comments_link(__('← Older Comments','dreamstour' )); ?></div>
<div class="next right"><?php next_comments_link(__('Newer Comments →' ,'dreamstour')); ?></div>
</footer>
<?php endif; ?>
<?php if (!comments_open() && get_comments_number()) : ?>
<p class="no-comments"><?php echo esc_html__( 'Comments are closed.','dreamstour' ); ?></p>
<?php endif; ?>
</div>
<?php } ?>
<div class="content_comments mt-3">
<div id="comments" class="comments">
<?php
$commenter = wp_get_current_commenter();
$req = get_option('require_name_email');
$aria_req = ($req ? " aria-required='true'" : '');
$comment_args = array(
'title_reply' => wp_kses('<div class="review-header"><h5 class="mb-2">' . esc_html__( 'Write A Comment' ,'dreamstour') . '</h5></div>', true),
'title_reply_to' => esc_html__( 'Leave a Reply to %s','dreamstour' ),
'fields' => apply_filters('comment_form_default_fields', array(
'author' => '<div class="row mt-3"><div class="col-md-6 "><div class="input-block"><label>Full Name <span class="text-danger">*</span></label><input type="text" name="author" value="' . esc_attr($commenter['comment_author']) . '" ' . esc_attr($aria_req) . ' class="form-control" placeholder="'. esc_attr('Name','dreamstour') .'" /></div></div>',
'email' => '<div class="col-md-6 "><div class="input-block"><label>Email Address <span class="text-danger">*</span></label><input type="text" name="email" value="' . esc_attr($commenter['comment_author_email']) . '" ' . esc_attr($aria_req) . ' class="form-control" placeholder="'. esc_html__('Email','dreamstour') .'" /></div></div></div>',
)),
'comment_field' => '<div class="row"><div class="col-md-12 "><div class="input-block"><label>Comments</label><textarea class="form-control" rows="7" name="comment" placeholder="'. esc_html__('Your Comment ...','dreamstour') .'"></textarea></div></div></div>',
'label_submit' => esc_html__('Submit Comment','dreamstour'),
'comment_notes_before' => '',
'comment_notes_after' => '',
'class_submit' => 'btn btn-primary submit-review',
'submit_before' => '<div class="submit-section">',
'submit_after' => '</div>',
);
?>
<?php
// Get the current post object safely
$current_post = get_post();
// Check if the post exists and comments are open
if ( $current_post && comments_open( $current_post->ID ) ) : ?>
<div class="commentform">
<div class="review-sec mb-0">
<?php
// Display the comment form for this specific post
comment_form( $comment_args, $current_post->ID );
?>
</div>
</div>
<?php endif; ?>
</div>
</div>