site_vitrine/theme/comments.php

77 lines
3.5 KiB
PHP

<?php
/**
* Comments Template
*
* @package Navier_Instruments
*/
if (post_password_required()) {
return;
}
?>
<div id="comments" class="comments-area">
<?php if (have_comments()) : ?>
<h2 class="comments-title">
<?php
$navier_comment_count = get_comments_number();
if ('1' === $navier_comment_count) {
printf(
/* translators: 1: title. */
esc_html__('One thought on &ldquo;%1$s&rdquo;', 'navier-instruments'),
'<span>' . wp_kses_post(get_the_title()) . '</span>'
);
} else {
printf(
/* translators: 1: comment count number, 2: title. */
esc_html(_nx('%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $navier_comment_count, 'comments title', 'navier-instruments')),
number_format_i18n($navier_comment_count),
'<span>' . wp_kses_post(get_the_title()) . '</span>'
);
}
?>
</h2>
<?php the_comments_navigation(); ?>
<ol class="comment-list">
<?php
wp_list_comments(array(
'style' => 'ol',
'short_ping' => true,
'callback' => 'navier_comment_callback',
'avatar_size' => 56,
));
?>
</ol>
<?php
the_comments_navigation();
if (!comments_open()) :
?>
<p class="no-comments"><?php esc_html_e('Comments are closed.', 'navier-instruments'); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php
comment_form(array(
'class_form' => 'comment-form',
'class_submit' => 'btn btn--primary',
'title_reply' => esc_html__('Leave a Comment', 'navier-instruments'),
'title_reply_to' => esc_html__('Leave a Reply to %s', 'navier-instruments'),
'cancel_reply_link' => esc_html__('Cancel Reply', 'navier-instruments'),
'label_submit' => esc_html__('Post Comment', 'navier-instruments'),
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . esc_html__('Comment', 'navier-instruments') . ' <span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required" class="form-textarea"></textarea></p>',
'fields' => array(
'author' => '<p class="comment-form-author"><label for="author">' . esc_html__('Name', 'navier-instruments') . ' <span class="required">*</span></label><input id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30" maxlength="245" required="required" class="form-input" /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . esc_html__('Email', 'navier-instruments') . ' <span class="required">*</span></label><input id="email" name="email" type="email" value="' . esc_attr($commenter['comment_author_email']) . '" size="30" maxlength="100" aria-describedby="email-notes" required="required" class="form-input" /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . esc_html__('Website', 'navier-instruments') . '</label><input id="url" name="url" type="url" value="' . esc_attr($commenter['comment_author_url']) . '" size="30" maxlength="200" class="form-input" /></p>',
),
));
?>
</div><!-- #comments -->