<?php


function howcan_bootstrap_comment_form_fields( $fields ) {
    $fields['author'] = '
        <div class="form-group mb-3">
            <label for="author">Name</label>
            <input id="author" name="author" type="text" class="form-control" required>
        </div>';

    $fields['email'] = '
        <div class="form-group mb-3">
            <label for="email">Email</label>
            <input id="email" name="email" type="email" class="form-control" required>
        </div>';

    $fields['url'] = '
        <div class="form-group mb-3">
            <label for="url">Website</label>
            <input id="url" name="url" type="url" class="form-control">
        </div>';

    return $fields;
}
add_filter( 'comment_form_default_fields',
'howcan_bootstrap_comment_form_fields' ); 
// end bootstrap comment from field 





// ================================
// HowCan Theme Functions
// bootstrap comment feild 
// ================================


function howcan_bootstrap_comment_field( $field ) {
    return '
        <div class="form-group mb-3">
            <label for="comment">Comment</label>
            <textarea id="comment" name="comment" class="form-control" rows="5" required></textarea>
        </div>';
}
add_filter( 'comment_form_field_comment', 'howcan_bootstrap_comment_field' );
// end 



// ================================
// HowCan Theme Functions
// bootstrap comment submit button 
// ================================

function howcan_bootstrap_submit_button( $defaults ) {
    $defaults['class_submit'] = 'btn btn-dark mt-2';
    return $defaults;
}
add_filter( 'comment_form_defaults', 'howcan_bootstrap_submit_button' ); //end 




// ================================
// HowCan Theme Functions
// bootstrap comment 
// ================================

function howcan_bootstrap_comment( $comment, $args, $depth ) {
    ?>
    <li <?php comment_class( 'media mb-4' ); ?> id="comment-<?php comment_ID(); ?>">
        <?php echo get_avatar( $comment, 64, '', '', array( 'class' => 'mr-3 rounded-circle' ) ); ?>
        <div class="media-body comment-content">
            <h5 class="mt-0 mb-1">
                <?php comment_author_link(); ?>
                <small class="text-muted"> • <?php comment_date(); ?> at <?php comment_time(); ?></small>
            </h5>
            <?php if ( $comment->comment_approved == '0' ) : ?>
                <div class="alert alert-info">
                
                  <?php echo esc_html__( 'Your comment is awaiting moderation.', 'howcan' ); ?>
                  
                 </div>
            <?php endif; ?>
            <p><?php comment_text(); ?></p>
            <?php
            comment_reply_link( array_merge( $args, array(
                'reply_text' => 'Reply',
                'depth'      => $depth,
                'max_depth'  => $args['max_depth'],
                'class'      => 'btn btn-sm btn-outline-dark'
            ) ) );
            ?>
        </div>
    </li>
    <?php
} //end 
