| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * The template for displaying comments. |
|---|
| 4 | * |
|---|
| 5 | * This is the template that displays the area of the page that contains both the current comments |
|---|
| 6 | * and the comment form. |
|---|
| 7 | * |
|---|
| 8 | * @link https://codex.wordpress.org/Template_Hierarchy |
|---|
| 9 | * |
|---|
| 10 | * @package Xolo |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | /* |
|---|
| 14 | * If the current post is protected by a password and |
|---|
| 15 | * the visitor has not yet entered the password we will |
|---|
| 16 | * return early without loading the comments. |
|---|
| 17 | */ |
|---|
| 18 | if ( post_password_required() ) { |
|---|
| 19 | return; |
|---|
| 20 | } |
|---|
| 21 | ?> |
|---|
| 22 | <div class="xl-column-12"> |
|---|
| 23 | <?php do_action( 'xolo_comment_form_before'); ?> |
|---|
| 24 | <div id="comments" class="comments-area"> |
|---|
| 25 | <div class="comments-title"> |
|---|
| 26 | <h3><?php xolo_comment_count(); ?></h3> |
|---|
| 27 | </div> |
|---|
| 28 | <?php |
|---|
| 29 | // You can start editing here -- including this comment! |
|---|
| 30 | if ( have_comments() ) : ?> |
|---|
| 31 | <div class="single-comments-title"> |
|---|
| 32 | <h2> |
|---|
| 33 | <?php |
|---|
| 34 | printf( // WPCS: XSS OK. |
|---|
| 35 | esc_html('One thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'xolo'), |
|---|
| 36 | number_format_i18n( get_comments_number() ), |
|---|
| 37 | '<span>' . esc_html(get_the_title()) . '</span>' |
|---|
| 38 | ); |
|---|
| 39 | ?> |
|---|
| 40 | </h2> |
|---|
| 41 | </div> |
|---|
| 42 | |
|---|
| 43 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> |
|---|
| 44 | <nav id="comment-nav-above" class="navigation comment-navigation" role="navigation"> |
|---|
| 45 | <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'xolo' ); ?></h2> |
|---|
| 46 | <div class="nav-links"> |
|---|
| 47 | |
|---|
| 48 | <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'xolo' ) ); ?></div> |
|---|
| 49 | <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'xolo' ) ); ?></div> |
|---|
| 50 | |
|---|
| 51 | </div><!-- .nav-links --> |
|---|
| 52 | </nav><!-- #comment-nav-above --> |
|---|
| 53 | <?php endif; // Check for comment navigation. ?> |
|---|
| 54 | |
|---|
| 55 | <ol class="comment-list"> |
|---|
| 56 | <?php |
|---|
| 57 | wp_list_comments( array( |
|---|
| 58 | 'style' => 'ol', |
|---|
| 59 | 'short_ping' => true, |
|---|
| 60 | ) ); |
|---|
| 61 | ?> |
|---|
| 62 | </ol><!-- .comment-list --> |
|---|
| 63 | |
|---|
| 64 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?> |
|---|
| 65 | <nav id="comment-nav-below" class="navigation comment-navigation" role="navigation"> |
|---|
| 66 | <h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'xolo' ); ?></h2> |
|---|
| 67 | <div class="nav-links"> |
|---|
| 68 | <div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'xolo' ) ); ?></div> |
|---|
| 69 | <div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'xolo' ) ); ?></div> |
|---|
| 70 | </div><!-- .nav-links --> |
|---|
| 71 | </nav><!-- #comment-nav-below --> |
|---|
| 72 | <?php |
|---|
| 73 | endif; // Check for comment navigation. |
|---|
| 74 | |
|---|
| 75 | endif; // Check for have_comments(). |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | // If comments are closed and there are comments, let's leave a little note, shall we? |
|---|
| 79 | if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|---|
| 80 | |
|---|
| 81 | <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'xolo' ); ?></p> |
|---|
| 82 | <?php |
|---|
| 83 | endif; |
|---|
| 84 | |
|---|
| 85 | comment_form( |
|---|
| 86 | array( |
|---|
| 87 | /* translators: %1$s opening anchor tag, %2$s closing anchor tag */ |
|---|
| 88 | 'must_log_in' => '<p class="must-log-in">' . sprintf( esc_html__( 'You must be %1$slogged in%2$s to post a comment.', 'xolo' ), '<a href="' . wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) . '">', '</a>' ) . '</p>', // phpcs:ignore |
|---|
| 89 | 'logged_in_as' => '<p class="logged-in-as">' . esc_html__( 'Logged in as', 'xolo' ) . ' <a href="' . esc_url( admin_url( 'profile.php' ) ) . '">' . $user_identity . '</a> <a href="' . wp_logout_url( get_permalink() ) . '" title="' . esc_html__( 'Log out of this account', 'xolo' ) . '">' . esc_html__( 'Log out?', 'xolo' ) . '</a></p>', |
|---|
| 90 | 'class_submit' => 'xl-btn', |
|---|
| 91 | 'comment_field' => '<p class="comment-form-comment"><textarea name="comment" id="comment" cols="45" rows="8" class="comment-textarea" placeholder="' . esc_attr__( 'Write a comment', 'xolo' ) . '" required="required"></textarea></p>', |
|---|
| 92 | 'id_submit' => 'comment-submit', |
|---|
| 93 | ) |
|---|
| 94 | ); |
|---|
| 95 | ?> |
|---|
| 96 | </div> |
|---|
| 97 | </div> |
|---|