Upload via Git Manager GUI - comments.php

This commit is contained in:
2026-03-29 20:27:46 +00:00
parent 7870995bab
commit be9c444ba2

View File

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