<?php
/**
 * The template for displaying comments.
 * This is the template that displays the area of the page that contains both the current comments
 * and the comment form.
 *
 * @package Alico
 */

/*
 * 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() ) {
    return;
} ?>

<div id="comments" class="comments-area">

    <?php
    // You can start editing here -- including this comment!
    if ( have_comments() ) : ?>
        <div class="comment-list-wrap">
            <h2 class="comments-title">
                <?php
                    $comment_count = get_comments_number();
                    if ( 1 === intval($comment_count) ) {
                        echo esc_html__( '1 Comment', 'alico' );
                    } else {
                        echo esc_attr( $comment_count ).' '.esc_html__('Comments', 'alico');
                    }
                ?>
            </h2><!-- .comments-title -->
            <?php the_comments_navigation(); ?>

            <ul class="comment-list">
                <?php
                    wp_list_comments( array(
                        'style'      => 'ul',
                        'short_ping' => true,
                        'callback'   => 'alico_comment_list',
                        'max_depth'  => 3
                    ) );
                ?>
            </ul><!-- .comment-list -->

            <?php the_comments_navigation(); ?>
        </div>
        <?php if ( ! comments_open() ) : ?>
            <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'alico' ); ?></p>
        <?php
        endif;

    endif; // Check for have_comments().

$args = array(
        'id_form'           => 'commentform',
        'id_submit'         => 'submit',
        'title_reply'       => esc_attr__( 'Leave A Comment', 'alico'),
        'title_reply_to'    => esc_attr__( 'Leave A Comment To ', 'alico') . '%s',
        'cancel_reply_link' => esc_attr__( 'Cancel Comment', 'alico'),
        'label_submit'      => esc_attr__( 'Post Comment', 'alico'),
        'comment_notes_before' => '',
        'fields' => apply_filters( 'comment_form_default_fields', array(

                'author' =>
                '<div class="row"><div class="comment-form-author col-lg-4 col-md-4 col-sm-12">'.
                '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
                '" size="30" placeholder="'.esc_attr__('Name*', 'alico').'"/></div>',

                'email' =>
                '<div class="comment-form-email col-lg-4 col-md-4 col-sm-12">'.
                '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .
                '" size="30" placeholder="'.esc_attr__('Email*', 'alico').'"/></div>',

                'website' =>
                '<div class="comment-form-website col-lg-4 col-md-4 col-sm-12">'.
                '<input id="website" name="url" type="text" value="" size="30" placeholder="'.esc_attr__('Website*', 'alico').'"/></div></div>',
        )
        ),
        'comment_field' =>  '<div class="comment-form-comment"><textarea id="comment" name="comment" cols="45" rows="8" placeholder="'.esc_attr__('Comment*', 'alico').'" aria-required="true">' .
        '</textarea></div>',
);
comment_form($args);
?>

</div><!-- #comments -->