retrogeekreloaded/comments.php
2024-01-28 20:56:21 +01:00

118 lines
3.9 KiB
PHP

<?php
/**
****************************************************************************
** RETROGEEK RELOADED SOURCE FILE **
** Copyright (c) 2021-2022 Tuxlog **
** Copyright (c) 2024 JeremyStarTM & Contributors **
** Licensed under the GNU General Public License v3 **
****************************************************************************
** This program is free software: you can redistribute it and/or modify **
** it under the terms of the GNU General Public License as published by **
** the Free Software Foundation, either version 3 of the License, or **
** (at your option) any later version. **
** **
** This program is distributed in the hope that it will be useful, **
** but WITHOUT ANY WARRANTY; without even the implied warranty of **
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the **
** GNU General Public License for more details. **
** **
** You should have received a copy of the GNU General Public License **
** along with this program. If not, see <https://www.gnu.org/licenses/>. **
****************************************************************************
** comments.php (Comments) **
** **
** This source file is handles the comment section. This includes viewing **
** comments and posting comments. **
****************************************************************************
*/
?>
<?php
/*
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if(post_password_required()) {
return;
}
?>
<div id="comments" class="comments-area">
<?php if(have_comments()) : ?>
<hr>
<h5 class="comments-title">
<?php
$comments_number = get_comments_number();
if('1' === $comments_number) {
/* translators: %s: Post title. */
printf(
esc_attr(
/* translators: 1: heading for comments */
_x(
'Ein Gedanke zu &ldquo;%s&rdquo;',
'comments title',
'retrogeek'
)
),
esc_attr(
get_the_title()
)
);
} else {
printf(
esc_attr(
/* translators: 1: Number of comments, 2: Post title. */
_nx(
'%1$s Gedanken zu &ldquo;%2$s&rdquo;',
'%1$s Gedanken zu &ldquo;%2$s&rdquo;',
$comments_number,
'comments title',
'retrogeek'
)
),
esc_attr(number_format_i18n($comments_number)),
esc_attr(
get_the_title()
)
);
}
?>
</h5>
<?php the_comments_navigation(); ?>
<ol class="comment-list">
<?php
wp_list_comments(
array(
'type' => 'all',
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 42,
)
);
?>
</ol><!-- .comment-list -->
<?php the_comments_navigation(); ?>
<?php endif; // Check for have_comments(). ?>
<?php
// If comments are closed and there are comments, let's leave a little note, shall we?
if(! comments_open() && get_comments_number() && post_type_supports(get_post_type(), 'comments')) :
?>
<p class="no-comments"><?php esc_html_e('Die Kommentarfunktion wurde deaktiviert.', 'retrogeek'); ?></p>
<?php endif; ?>
<?php
comment_form(
array(
'title_reply_before' => '<h5 id="reply-title" class="comment-reply-title">',
'title_reply_after' => '</h5>',
)
);
?>
</div><!-- .comments-area -->