View file StuffPost/stuffpost/comments.php

File size: 2.38Kb
<?php

// Password Protection, Not load directly

  if ( post_password_required() ) { ?><div class="alert alert-warning"><?php esc_html_e('This post is password protected. Enter the password to view comments.', 'stuffpost'); ?></div><?php return; }

// COMMENTSAREA
if (have_comments()) : ?>

  <div class="text-center mb-4">
    <span class="f-main h2 c-black"><?php esc_html_e(' Comments', 'stuffpost'); ?></span>
  </div>

  <ul class="pt-2 l-black comment-list">
    <?php wp_list_comments('avatar_size=46');?>
  </ul>

  <p class="text-muted">
    <?php paginate_comments_links(); ?>
  </p>

  <?php else :
    if (comments_open()) :
      ?><p class='alert alert-info'><?php esc_html_e('Be the first to write a comment.', 'stuffpost'); ?></p><?php
    else :
     ?><p class='alert alert-warning'><?php esc_html_e('Comments are closed for this post.', 'stuffpost'); ?></p><?php
    endif;
  endif; ?>

<?php if (comments_open()) : ?>
  <section id="respond" class="c-meta l-meta text-center">
    <?php $commenter = wp_get_current_commenter();
    $req = get_option( 'require_name_email' );
    $aria_req = ( $req ? " aria-required='true'" : '' );
    $comment_args = array(
      'class_submit'        => 'submit btn',

      'title_reply_before'  => '<div class="text-center mt-4"><span class="f-main h3 c-black">',
      'title_reply_after'   => '</span></div>',

      'cancel_reply_before' => '<span class="f-text small text-uppercase pl-2">',
      'cancel_reply_after'  => '</span>',

      'fields' => apply_filters( 'comment_form_default_fields', array(
        'author' => '<div class="row"><div class="author col form-group"><input id="author" class="form-control" placeholder="'.esc_html__( 'Name', 'stuffpost' ).'" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>',
        'email'  => '<div class="email col form-group"><input id="email" class="form-control" placeholder="'.esc_html__( 'Email', 'stuffpost' ).'" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></div></div>',
      )),

      'comment_field' =>  '<div class="form-group"><textarea name="comment" class="form-control" id="comment" rows="5" aria-required="true"></textarea></div>',


    );
    comment_form($comment_args); ?>
  </section>
<?php endif; ?>