mirror of
https://ghproxy.net/https://github.com/AlxMedia/blogcards.git
synced 2025-08-26 07:41:04 +08:00
112 lines
2.5 KiB
PHP
112 lines
2.5 KiB
PHP
|
<?php
|
||
|
if ( post_password_required() ) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if ( $comments ) {
|
||
|
?>
|
||
|
|
||
|
<div class="comments" id="comments">
|
||
|
|
||
|
<?php
|
||
|
$comments_number = get_comments_number();
|
||
|
?>
|
||
|
|
||
|
<div class="comments-header">
|
||
|
|
||
|
<h2 class="comment-reply-title">
|
||
|
<?php
|
||
|
if ( ! have_comments() ) {
|
||
|
_e( 'Leave a comment', 'blogcards' );
|
||
|
} elseif ( '1' === $comments_number ) {
|
||
|
/* translators: %s: Post title. */
|
||
|
printf( _x( 'One reply on “%s”', 'comments title', 'blogcards' ), get_the_title() );
|
||
|
} else {
|
||
|
printf(
|
||
|
/* translators: 1: Number of comments, 2: Post title. */
|
||
|
_nx(
|
||
|
'%1$s reply on “%2$s”',
|
||
|
'%1$s replies on “%2$s”',
|
||
|
$comments_number,
|
||
|
'comments title',
|
||
|
'blogcards'
|
||
|
),
|
||
|
number_format_i18n( $comments_number ),
|
||
|
get_the_title()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
</h2><!--/.comment-reply-title-->
|
||
|
|
||
|
</div><!--/.comments-header-->
|
||
|
|
||
|
<div class="commentlist">
|
||
|
|
||
|
<?php
|
||
|
wp_list_comments(
|
||
|
array(
|
||
|
'avatar_size' => 64,
|
||
|
)
|
||
|
);
|
||
|
|
||
|
$comment_pagination = paginate_comments_links(
|
||
|
array(
|
||
|
'echo' => false,
|
||
|
'end_size' => 0,
|
||
|
'mid_size' => 0,
|
||
|
'next_text' => __( 'Newer Comments', 'blogcards' ) . ' <span aria-hidden="true">→</span>',
|
||
|
'prev_text' => '<span aria-hidden="true">←</span> ' . __( 'Older Comments', 'blogcards' ),
|
||
|
)
|
||
|
);
|
||
|
|
||
|
if ( $comment_pagination ) {
|
||
|
$pagination_classes = '';
|
||
|
|
||
|
// If we're only showing the "Next" link, add a class indicating so.
|
||
|
if ( false === strpos( $comment_pagination, 'prev page-numbers' ) ) {
|
||
|
$pagination_classes = ' only-next';
|
||
|
}
|
||
|
// If we're only showing the "Prev" link, add a class indicating so.
|
||
|
if ( false === strpos( $comment_pagination, 'next page-numbers' ) ) {
|
||
|
$pagination_classes = ' only-prev';
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
<nav class="comments-nav group<?php echo $pagination_classes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- static output ?>" aria-label="<?php esc_attr_e( 'Comments', 'blogcards' ); ?>">
|
||
|
<?php echo wp_kses_post( $comment_pagination ); ?>
|
||
|
</nav>
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
</div><!--/.commentlist-->
|
||
|
|
||
|
</div><!--/.comments-->
|
||
|
|
||
|
<?php
|
||
|
}
|
||
|
|
||
|
if ( comments_open() || pings_open() ) {
|
||
|
|
||
|
comment_form(
|
||
|
array(
|
||
|
'title_reply_before' => '<h2 id="reply-title" class="comment-reply-title">',
|
||
|
'title_reply_after' => '</h2>',
|
||
|
)
|
||
|
);
|
||
|
|
||
|
} elseif ( is_single() ) {
|
||
|
|
||
|
?>
|
||
|
|
||
|
<div class="comment-respond" id="respond">
|
||
|
|
||
|
<p class="comments-closed"><?php _e( 'Comments are closed.', 'blogcards' ); ?></p>
|
||
|
|
||
|
</div><!--/#respond-->
|
||
|
|
||
|
<?php
|
||
|
}
|