158 lines
6.7 KiB
PHP
158 lines
6.7 KiB
PHP
<?php
|
|
// Kein direkter Zugriff
|
|
if ( ! defined('ABSPATH') ) exit;
|
|
|
|
// Wenn Passwort erforderlich, nichts anzeigen
|
|
if ( post_password_required() ) {
|
|
return;
|
|
}
|
|
?>
|
|
|
|
<div id="comments" class="comments-area">
|
|
|
|
<?php if ( have_comments() ) : ?>
|
|
|
|
<h3 class="comments-title">
|
|
<i class="fas fa-comments"></i>
|
|
<?php
|
|
$comment_count = get_comments_number();
|
|
printf(
|
|
_n(
|
|
'%d Kommentar zu “%s”',
|
|
'%d Kommentare zu “%s”',
|
|
$comment_count,
|
|
'minecraft-modern-theme'
|
|
),
|
|
$comment_count,
|
|
'<span>' . get_the_title() . '</span>'
|
|
);
|
|
?>
|
|
</h3>
|
|
|
|
<!-- Ältere Kommentare / Pagination oben -->
|
|
<?php if ( get_comment_pages_count() > 1 && get_option('page_comments') ) : ?>
|
|
<nav class="comment-navigation" aria-label="<?php esc_attr_e('Kommentar-Navigation', 'minecraft-modern-theme'); ?>">
|
|
<div class="comment-nav-prev"><?php previous_comments_link( '<i class="fas fa-chevron-left"></i> ' . __('Ältere Kommentare', 'minecraft-modern-theme') ); ?></div>
|
|
<div class="comment-nav-next"><?php next_comments_link( __('Neuere Kommentare', 'minecraft-modern-theme') . ' <i class="fas fa-chevron-right"></i>' ); ?></div>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<ol class="comment-list">
|
|
<?php
|
|
wp_list_comments( array(
|
|
'style' => 'ol',
|
|
'short_ping' => true,
|
|
'avatar_size' => 48,
|
|
'callback' => 'minecraft_modern_comment_template',
|
|
) );
|
|
?>
|
|
</ol>
|
|
|
|
<!-- Neuere Kommentare / Pagination unten -->
|
|
<?php if ( get_comment_pages_count() > 1 && get_option('page_comments') ) : ?>
|
|
<nav class="comment-navigation" aria-label="<?php esc_attr_e('Kommentar-Navigation', 'minecraft-modern-theme'); ?>">
|
|
<div class="comment-nav-prev"><?php previous_comments_link( '<i class="fas fa-chevron-left"></i> ' . __('Ältere Kommentare', 'minecraft-modern-theme') ); ?></div>
|
|
<div class="comment-nav-next"><?php next_comments_link( __('Neuere Kommentare', 'minecraft-modern-theme') . ' <i class="fas fa-chevron-right"></i>' ); ?></div>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<?php endif; // have_comments() ?>
|
|
|
|
<?php
|
|
// Kommentarformular
|
|
if ( comments_open() ) :
|
|
comment_form( array(
|
|
'title_reply' => '<span><i class="fas fa-pencil-alt"></i> ' . __('Hinterlasse einen Kommentar', 'minecraft-modern-theme') . '</span>',
|
|
'title_reply_to' => __('Antworten auf %s', 'minecraft-modern-theme'),
|
|
'cancel_reply_link' => __('Abbrechen', 'minecraft-modern-theme'),
|
|
'label_submit' => __('Kommentar absenden', 'minecraft-modern-theme'),
|
|
'comment_notes_before' => '',
|
|
'comment_notes_after' => '',
|
|
'class_form' => 'comment-form',
|
|
'class_submit' => 'submit btn-comment-submit',
|
|
) );
|
|
elseif ( ! is_user_logged_in() ) :
|
|
?>
|
|
<div class="comments-closed-notice">
|
|
<i class="fas fa-lock"></i>
|
|
<?php _e('Kommentare sind für diesen Beitrag deaktiviert.', 'minecraft-modern-theme'); ?>
|
|
</div>
|
|
<?php
|
|
endif;
|
|
?>
|
|
|
|
</div><!-- #comments -->
|
|
|
|
<?php
|
|
/**
|
|
* Callback für den Kommentar-Template.
|
|
* Wird in functions.php nicht definiert, daher hier.
|
|
*/
|
|
if ( ! function_exists('minecraft_modern_comment_template') ) :
|
|
function minecraft_modern_comment_template( $comment, $args, $depth ) {
|
|
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
|
|
?>
|
|
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( empty($args['has_children']) ? '' : 'parent', $comment ); ?>>
|
|
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
|
|
|
|
<div class="comment-meta">
|
|
<div class="comment-author-avatar">
|
|
<?php echo get_avatar( $comment, $args['avatar_size'], '', '', array('class' => 'comment-avatar') ); ?>
|
|
</div>
|
|
<div class="comment-author-info">
|
|
<span class="comment-author-name">
|
|
<?php
|
|
$author_url = get_comment_author_url($comment);
|
|
if ( $author_url ) {
|
|
echo '<a href="' . esc_url($author_url) . '" rel="external nofollow">' . get_comment_author($comment) . '</a>';
|
|
} else {
|
|
echo esc_html( get_comment_author($comment) );
|
|
}
|
|
?>
|
|
</span>
|
|
<span class="comment-date">
|
|
<i class="fas fa-calendar-alt"></i>
|
|
<a href="<?php echo esc_url( get_comment_link($comment, $args) ); ?>">
|
|
<time datetime="<?php comment_date('c'); ?>">
|
|
<?php
|
|
printf(
|
|
__('%1$s um %2$s Uhr', 'minecraft-modern-theme'),
|
|
get_comment_date('', $comment),
|
|
get_comment_time('', false, false, $comment)
|
|
);
|
|
?>
|
|
</time>
|
|
</a>
|
|
</span>
|
|
</div>
|
|
|
|
<?php if ( '0' === $comment->comment_approved ) : ?>
|
|
<div class="comment-awaiting-moderation">
|
|
<i class="fas fa-clock"></i> <?php _e('Dein Kommentar wartet auf Freigabe.', 'minecraft-modern-theme'); ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="comment-content">
|
|
<?php comment_text(); ?>
|
|
</div>
|
|
|
|
<footer class="comment-footer">
|
|
<?php
|
|
comment_reply_link( array_merge( $args, array(
|
|
'add_below' => 'div-comment',
|
|
'depth' => $depth,
|
|
'max_depth' => $args['max_depth'],
|
|
'before' => '<div class="reply">',
|
|
'after' => '</div>',
|
|
) ) );
|
|
|
|
edit_comment_link( '<i class="fas fa-pencil-alt"></i> ' . __('Bearbeiten', 'minecraft-modern-theme'), '<div class="edit-link">', '</div>' );
|
|
?>
|
|
</footer>
|
|
|
|
</article>
|
|
<?php
|
|
}
|
|
endif;
|
|
?>
|