Redesign comment rendering and styling
This commit is contained in:
@@ -53,6 +53,34 @@ function c1024_2026_customize_register( $wp_customize ) {
|
||||
// Customize controls are registered only while the Customizer API is available.
|
||||
add_action( 'customize_register', 'c1024_2026_customize_register' );
|
||||
|
||||
/**
|
||||
* Render comments without the default avatar-heavy, numbered-list presentation.
|
||||
*
|
||||
* WordPress's Walker_Comment closes the wrapping list item after this callback.
|
||||
*/
|
||||
function c1024_2026_comment( $comment, $args, $depth ) {
|
||||
?>
|
||||
<li <?php comment_class( 'comment-item' ); ?> id="comment-<?php comment_ID(); ?>">
|
||||
<article class="comment-body" id="div-comment-<?php comment_ID(); ?>">
|
||||
<header class="comment-meta">
|
||||
<?php echo get_avatar( $comment, 44, '', sprintf( esc_attr__( 'Avatar for %s', 'c1024-2026' ), get_comment_author( $comment ) ), array( 'class' => 'comment-avatar' ) ); ?>
|
||||
<div class="comment-identity">
|
||||
<span class="comment-author"><?php echo wp_kses_post( get_comment_author_link( $comment ) ); ?></span>
|
||||
<time class="comment-published" datetime="<?php echo esc_attr( get_comment_date( DATE_W3C, $comment ) ); ?>"><?php echo esc_html( get_comment_date( '', $comment ) ); ?></time>
|
||||
<?php edit_comment_link( esc_html__( 'Edit', 'c1024-2026' ), '<span class="comment-edit-link">', '</span>' ); ?>
|
||||
</div>
|
||||
</header>
|
||||
<?php if ( '0' === $comment->comment_approved ) { ?>
|
||||
<p class="comment-awaiting-moderation"><?php esc_html_e( 'Your comment is awaiting moderation.', 'c1024-2026' ); ?></p>
|
||||
<?php } ?>
|
||||
<div class="comment-content"><?php comment_text(); ?></div>
|
||||
<footer class="comment-actions">
|
||||
<?php comment_reply_link( array_merge( $args, array( 'add_below' => 'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => esc_html__( 'Reply', 'c1024-2026' ) ) ) ); ?>
|
||||
</footer>
|
||||
</article>
|
||||
<?php
|
||||
}
|
||||
|
||||
function c1024_2026_excerpt_more( $more ) {
|
||||
return '…';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user