<?php
if (post_password_required()) {
    return;
}
?>

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

    <?php if (have_comments()) : ?>
        <h3 class="comments-title">
            <?php
            $comment_count = get_comments_number();
            if ($comment_count == 1) {
                echo '1 Comentario';
            } else {
                echo $comment_count . ' Comentarios';
            }
            ?>
        </h3>

        <ol class="comment-list">
            <?php
            wp_list_comments(array(
                'style'       => 'ol',
                'short_ping'  => true,
                'callback'    => 'pulsegrid_comment_callback',
                'avatar_size' => 32,
                'max_depth'   => 5
            ));
            ?>
        </ol>

        <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
            <nav class="comment-navigation">
                <div class="nav-previous"><?php previous_comments_link('&larr; Comentarios anteriores'); ?></div>
                <div class="nav-next"><?php next_comments_link('Comentarios siguientes &rarr;'); ?></div>
            </nav>
        <?php endif; ?>

    <?php endif; ?>

    <?php if (!comments_open() && get_comments_number() && post_type_supports(get_post_type(), 'comments')) : ?>
        <p class="no-comments">Los comentarios están cerrados.</p>
    <?php endif; ?>

    <?php
    comment_form(array(
        'title_reply'          => 'Deja un comentario',
        'title_reply_to'       => 'Responder a %s',
        'cancel_reply_link'    => 'Cancelar respuesta',
        'label_submit'         => 'Publicar comentario',
        'comment_notes_before' => '',
        'comment_notes_after'  => '',
        'format'               => 'html5'
    ));
    ?>

</div>
