mirror of
https://ghproxy.net/https://github.com/AlxMedia/blogcards.git
synced 2025-08-26 07:41:04 +08:00
Add required comments template
This commit is contained in:
parent
350566831f
commit
4e75f37915
6 changed files with 157 additions and 26 deletions
111
comments.php
Normal file
111
comments.php
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?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
|
||||
}
|
|
@ -443,19 +443,6 @@ if ( ! function_exists( 'blogcards_excerpt_length' ) ) {
|
|||
add_filter( 'excerpt_length', 'blogcards_excerpt_length', 999 );
|
||||
|
||||
|
||||
/* Comments avatar size
|
||||
/* ------------------------------------ */
|
||||
if ( ! function_exists( 'blogcards_comments_avatar_size' ) ) {
|
||||
|
||||
function blogcards_comments_avatar_size( $args ) {
|
||||
$args['avatar_size'] = 64;
|
||||
return $args;
|
||||
}
|
||||
|
||||
}
|
||||
add_filter( 'wp_list_comments_args', 'blogcards_comments_avatar_size' );
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- *
|
||||
* Actions
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Blogcards\n"
|
||||
"POT-Creation-Date: 2024-04-18 16:37+0200\n"
|
||||
"POT-Creation-Date: 2024-04-19 12:32+0200\n"
|
||||
"PO-Revision-Date: 2018-09-21 21:27+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
|
@ -19,6 +19,36 @@ msgstr ""
|
|||
"X-Poedit-SearchPathExcluded-0: functions/class-tgm-plugin-activation.php\n"
|
||||
"X-Poedit-SearchPathExcluded-1: functions/kirki\n"
|
||||
|
||||
#: comments.php:20
|
||||
msgid "Leave a comment"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:23
|
||||
#, php-format
|
||||
msgid "One reply on “%s”"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:28
|
||||
#, php-format
|
||||
msgid "%1$s reply on “%2$s”"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:58
|
||||
msgid "Newer Comments"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:59
|
||||
msgid "Older Comments"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:76
|
||||
msgid "Comments"
|
||||
msgstr ""
|
||||
|
||||
#: comments.php:106
|
||||
msgid "Comments are closed."
|
||||
msgstr ""
|
||||
|
||||
#: content.php:23 single.php:43
|
||||
msgid "by"
|
||||
msgstr ""
|
||||
|
@ -75,19 +105,19 @@ msgstr ""
|
|||
msgid "Footer 4"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:526
|
||||
#: functions.php:513
|
||||
msgid "Alx Extensions"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:530
|
||||
#: functions.php:517
|
||||
msgid "Meta Box"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:534
|
||||
#: functions.php:521
|
||||
msgid "Regenerate Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: functions.php:538
|
||||
#: functions.php:525
|
||||
msgid "WP-PageNavi"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -68,8 +68,9 @@ Blog images
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 1.0.5 - 2024-04-18 =
|
||||
= 1.0.5 - 2024-04-19 =
|
||||
* Added header search button and option to enable or disable it
|
||||
* Added required comments template
|
||||
|
||||
= 1.0.4 - 2024-04-16 =
|
||||
* Added styling option to set theme color
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
body.single .small-heading { margin-left: 20px; margin-right: 20px; }
|
||||
|
||||
.pagination { margin-top: 60px; }
|
||||
.comments-nav .next,
|
||||
.comments-nav .prev { width: 100%; }
|
||||
|
||||
.page-title { padding: 20px 20px 0; }
|
||||
.page-title .contentbox { font-size: 15px; margin-bottom: 20px; margin-top: -20px; }
|
||||
|
|
14
style.css
14
style.css
|
@ -160,8 +160,7 @@ transition: all .2s ease;
|
|||
/* base : headings
|
||||
/* ------------------------------------ */
|
||||
.heading,
|
||||
#reply-title,
|
||||
h3#comments { font-weight: normal; font-size: 18px; font-weight: 600; margin-bottom: 1em; line-height: 1.5em; }
|
||||
.comment-reply-title { font-weight: normal; font-size: 18px; font-weight: 600; margin-bottom: 1em; line-height: 1.5em; }
|
||||
.heading i { font-size: 22px; margin-right: 6px; }
|
||||
|
||||
|
||||
|
@ -1018,7 +1017,7 @@ body.page .entry-header .entry-title { margin: 20px 0; }
|
|||
.entry-comments { margin-bottom: 60px; }
|
||||
|
||||
.commentlist { margin-bottom: 20px; }
|
||||
.commentlist li { padding-left: 60px; font-size: 14px; line-height: 22px; font-weight: 400; }
|
||||
.commentlist li { padding-left: 60px; font-size: 14px; line-height: 22px; font-weight: 400; list-style: none; }
|
||||
.commentlist .comment-body { clear: both; position: relative; padding-bottom: 15px; }
|
||||
.commentlist .comment-author,
|
||||
.commentlist .comment-metadata,
|
||||
|
@ -1059,10 +1058,11 @@ body.page .entry-header .entry-title { margin: 20px 0; }
|
|||
|
||||
/* comments : nav
|
||||
/* ------------------------------------ */
|
||||
.comments-nav { margin-bottom: 20px; }
|
||||
.comments-nav a { font-weight: 600; }
|
||||
.comments-nav .nav-previous { float: left; }
|
||||
.comments-nav .nav-next { float: right; }
|
||||
.comments-nav { margin: 40px 0; text-align: center; font-weight: 600; }
|
||||
.comments-nav.only-next { text-align: left; }
|
||||
.comments-nav.only-prev { text-align: right; }
|
||||
.comments-nav .prev { float: left; }
|
||||
.comments-nav .next { float: right; }
|
||||
|
||||
/* comments : form
|
||||
/* ------------------------------------ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue