<?php
/**
 * Comments template.
 *
 * @package ttsunsolar
 */

if ( post_password_required() ) {
	return;
}
?>
<div id="comments" class="comments-area">
	<?php if ( have_comments() ) : ?>
		<h2 class="comments-title">
			<?php
			$ttsunsolar_count = get_comments_number();
			printf(
				/* translators: 1: comment count number, 2: post title */
				esc_html( _n( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', $ttsunsolar_count, 'ttsunsolar' ) ),
				esc_html( number_format_i18n( $ttsunsolar_count ) ),
				esc_html( get_the_title() )
			);
			?>
		</h2>
		<ol class="comment-list">
			<?php
			wp_list_comments(
				array(
					'style'      => 'ol',
					'short_ping' => true,
				)
			);
			?>
		</ol>
		<?php the_comments_navigation(); ?>
	<?php endif; ?>

	<?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.', 'ttsunsolar' ); ?></p>
		<?php
	endif;

	comment_form(
		array(
			'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">',
			'title_reply_after'  => '</h3>',
			'class_submit'       => 'submit button button--primary',
			'submit_button'      => '<button name="%1$s" type="submit" id="%2$s" class="%3$s">%4$s</button>',
			'submit_field'       => '<p class="form-submit">%1$s %2$s</p>',
		)
	);
	?>
</div>
