hesabixWpTheme/comments.php
2026-05-22 13:52:15 +03:30

52 lines
1.6 KiB
PHP

<?php
/**
* قالب بخش نظرات
*
* @package Hesabix2
*/
if (post_password_required()) {
return;
}
$comment_count = get_comments_number();
?>
<section id="comments" class="single-comments">
<h2 class="single-comments__title">
<?php echo $comment_count > 0 ? number_format_i18n($comment_count) . ' نظر' : 'نظرات'; ?>
</h2>
<?php if (have_comments()) : ?>
<ol class="single-comments__list">
<?php
wp_list_comments(array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 44,
'callback' => 'hesabix2_comment_callback',
'max_depth' => 3,
));
?>
</ol>
<?php the_comments_navigation(array('prev_text' => '← قبلی', 'next_text' => 'بعدی →')); ?>
<?php endif; ?>
<?php if (comments_open()) : ?>
<div class="single-comments__form-wrap">
<h3 class="single-comments__form-title"><?php echo $comment_count > 0 ? 'پاسخ دهید' : 'نظر خود را بنویسید'; ?></h3>
<?php
comment_form(array(
'class_form' => 'single-comment-form',
'title_reply' => '',
'title_reply_to' => '',
'cancel_reply_link' => 'لغو',
'label_submit' => __('ارسال نظر', 'hesabix2'),
'class_submit' => 'single-comment-submit',
));
?>
</div>
<?php elseif ($comment_count > 0) : ?>
<p class="single-comments__closed">دریافت نظرات جدید بسته شده است.</p>
<?php endif; ?>
</section>