<?php
/**
* The template for displaying comments
*
* The area of the page that contains both current comments
* and the comment form.
*
* @package Katerio
*
*/
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() || ( is_singular( 'post' ) && ! th90_opt( 'post_comment' ) ) || ( ! have_comments() && ! comments_open() ) ) {
return;
}
?>
<div class="element-article article-comments clearfix">
<?php
if ( th90_opt( 'post_comment_collapse' ) && ! th90_is_amp() ) {
?>
<button type="submit" class="comment-collapse">
<?php echo sprintf( esc_html__( 'Show Comments (%1$s)', 'katerio' ), number_format_i18n( get_comments_number() ) ); ?>
</button>
<?php
}
?>
<div id="comments" class="entry-comments">
<?php if ( have_comments() ) :
if ( get_comments_number() > 1 ) {
$comments_number_output = str_replace( '%', number_format_i18n( get_comments_number() ), esc_html__( '% Comments', 'katerio' ) );
} elseif ( get_comments_number() == 0 ) {
$comments_number_output = esc_html__( 'No Comments', 'katerio' );
} else {
$comments_number_output = esc_html__( '1 Comment', 'katerio' );
}
?>
<h3 class="comment-article-title h2"><?php echo esc_html( $comments_number_output ); ?></h3>
<ul class="comment-list">
<?php
wp_list_comments( array(
'style' => 'ul',
'short_ping' => true,
'avatar_size' => 80,
'callback' => 'th90_comment',
) );
?>
</ul>
<?php
the_comments_navigation( array(
'prev_text' => esc_html__( 'Older comments', 'katerio' ),
'next_text' => esc_html__( 'Newer comments', 'katerio' ),
) );
?>
<?php endif; ?>
<?php // If comments are closed and there are comments, let's leave a little note, shall we? ?>
<?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed', 'katerio' ); ?></p>
<?php endif; ?>
<?php
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$html_req = ( $req ? " required='required'" : '' );
$form_fields = array(
'url' => sprintf(
'<p class="comment-form-url">%s</p>',
sprintf(
'<input id="url" name="url" %1$s value="%2$s" placeholder="%3$s" size="30" maxlength="200" />',
'type="text"',
esc_attr( $commenter['comment_author_url'] ),
esc_html__( 'Website', 'katerio' ),
)
),
'author' => sprintf(
'<p class="comment-form-author">%1$s</p>',
sprintf(
'<input id="author" name="author" type="text" value="%1$s" placeholder="%2$s%3$s" size="30" maxlength="245"%4$s />',
esc_attr( $commenter['comment_author'] ),
esc_html__( 'Your Name', 'katerio' ),
( $req ? ' *' : '' ),
$html_req
)
),
'email' => sprintf(
'<p class="comment-form-email">%1$s</p>',
sprintf(
'<input id="email" name="email" %1$s value="%2$s" placeholder="%3$s%4$s" size="30" maxlength="100" aria-describedby="email-notes"%5$s />',
'type="text"',
esc_attr( $commenter['comment_author_email'] ),
esc_html__( 'Your Email', 'katerio' ),
( $req ? ' *' : '' ),
$html_req
)
),
);
$form_args = array(
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title h2">',
'title_reply_after' => '</h3>',
'cancel_reply_link' => th90_get_svg_icon( 'close' ),
'fields' => apply_filters( 'comment_form_default_fields', $form_fields ),
'comment_field' => sprintf(
'<p class="comment-form-comment">%s</p>',
sprintf(
'<textarea id="comment" name="comment" placeholder="%1$s" cols="45" rows="8" maxlength="65525" required="required"></textarea>',
esc_html__( 'Your Comment *', 'katerio' ),
)
),
);
comment_form( $form_args );
?>
</div>
</div>