balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

comments.php (4839B)


      1 <?php
      2 
      3 /**
      4  * The template for displaying comments
      5  *
      6  * This is the template that displays the area of the page that contains both the current comments
      7  * and the comment form.
      8  *
      9  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
     10  *
     11  * @package welbim
     12  */
     13 
     14 /*
     15  * If the current post is protected by a password and
     16  * the visitor has not yet entered the password we will
     17  * return early without loading the comments.
     18  */
     19 if (post_password_required()) {
     20 	return;
     21 }
     22 ?>
     23 
     24 <?php
     25 // You can start editing here -- including this comment!
     26 if (have_comments()) :
     27 	$comment_close = '';
     28 	if (!comments_open()) :
     29 		$comment_close = 'comment-close';
     30 	endif;
     31 ?>
     32 
     33 	<div class="comments-area <?php echo esc_attr($comment_close); ?>" id="comments">
     34 		<div class="group-title">
     35 			<h3>
     36 				<?php
     37 				$welbim_comment_count = get_comments_number();
     38 				if ('1' === $welbim_comment_count) {
     39 					printf(
     40 						/* translators: 1: title. */
     41 						esc_html__('One Comment', 'welbim')
     42 					);
     43 				} else {
     44 					printf( // WPCS: XSS OK.
     45 						/* translators: 1: comment count number, 2: title. */
     46 						esc_html(_nx('%1$s Comment', '%1$s Comments ', $welbim_comment_count, 'comments title', 'welbim'), 'welbim'),
     47 						number_format_i18n($welbim_comment_count)
     48 					);
     49 				}
     50 				?>
     51 			</h3>
     52 		</div>
     53 		<?php
     54 		if (have_comments()) :
     55 			the_comments_navigation();
     56 		?>
     57 			<div class="comment-list comments-form-area">
     58 				<?php
     59 				wp_list_comments(
     60 					array(
     61 						'style'      => 'div',
     62 						'callback'   => 'welbim_comments',
     63 						'short_ping' => true,
     64 					)
     65 				);
     66 				?>
     67 			</div>
     68 			<?php
     69 			the_comments_navigation();
     70 			// If comments are closed and there are comments, let's leave a little note, shall we?
     71 			if (!comments_open()) :
     72 			?>
     73 				<p class="no-comments"><?php esc_html_e('Comments are closed.', 'welbim'); ?></p>
     74 		<?php
     75 			endif;
     76 		endif;
     77 		?>
     78 	</div>
     79 <?php
     80 endif; // Check for have_comments().
     81 
     82 if (comments_open()) :
     83 ?>
     84 
     85 	<div class="comments-form">
     86 
     87 		<?php
     88 		$user                 	= wp_get_current_user();
     89 		$welbim_user_identity 	= $user->display_name;
     90 		$req                  	= get_option('require_name_email');
     91 		$aria_req             	= $req ? " aria-required='true'" : '';
     92 
     93 		$formargs = array(
     94 			'title_reply_before'   => '<div class="group-title"><h3>',
     95 			'title_reply_after'    => '</h3></div>',
     96 			'title_reply'          => esc_html__('Leave a Comment', 'welbim'),
     97 			'title_reply_to'       => esc_html__('Leave a Comment to %s', 'welbim'),
     98 			'cancel_reply_link'    => esc_html__('Cancel Reply', 'welbim'),
     99 
    100 			'comment_notes_before' => '<p class="email-not-publish">' .
    101 				esc_html__('Your email address will not be published.', 'welbim') . ($req ? '<span class="required">*</span>' : '') .
    102 				'</p>',
    103 			'submit_field'         => '<div class="row row-10"><div class="col-lg-12 col-md-12 col-sm-12 form-group">%1$s %2$s</div></div>',
    104 			'submit_button'        => '<button type="submit" name="%1$s" id="%2$s" class="%3$s theme-btn btn-style-one"><span class="btn-title">%4$s</span></button>',
    105 			'label_submit'         => esc_html__('Submit', 'welbim'),
    106 			'comment_field'        => '<div class="row row-10"><div class="col-lg-12 col-md-12 col-sm-12 form-group"><textarea id="comment" name="comment" placeholder="' . esc_attr__('Type your comments...', 'welbim') . '"  >' .
    107 				'</textarea></div></div>',
    108 			'must_log_in'          => '<div>' .
    109 				sprintf(
    110 					wp_kses(__('You must be <a href="%s">logged in</a> to post a comment.', 'welbim'), array('a' => array('href' => array()))),
    111 					wp_login_url(apply_filters('the_permalink', get_permalink()))
    112 				) . '</div>',
    113 			'logged_in_as'         => '<div class="logged-in-as">' .
    114 				sprintf(
    115 					wp_kses(__('Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="%4$s">Log out?</a>', 'welbim'), array('a' => array('href' => array()))),
    116 					esc_url(admin_url('profile.php')),
    117 					$welbim_user_identity,
    118 					wp_logout_url(apply_filters('the_permalink', get_permalink())),
    119 					esc_attr__('Log out of this account', 'welbim')
    120 				) . '</div>',
    121 
    122 			'comment_notes_after'  => '',
    123 			'fields'               => apply_filters(
    124 				'comment_form_default_fields',
    125 				array(
    126 					'author' =>	'<div class="row row-10"><div class="col-lg-6 col-md-6 col-sm-12 form-group">' . '<input id="author"  name="author" placeholder="' . esc_attr__('Your Name *', 'welbim') . '" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /></div>',
    127 					'email'  =>	'<div class="col-lg-6 col-md-6 col-sm-12 form-group">' . '<input id="email" name="email" type="text"  placeholder="' . esc_attr__('Email address *', 'welbim') . '" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /></div></div>',
    128 				)
    129 			),
    130 		);
    131 		?>
    132 		<?php
    133 		comment_form($formargs);
    134 		?>
    135 
    136 	</div>
    137 <?php endif; ?>