Skip to content

Instantly share code, notes, and snippets.

@generatepress
Last active September 18, 2018 16:53
Show Gist options
  • Save generatepress/6a9ad4e007ae0a7388bbbbb7b3ae068f to your computer and use it in GitHub Desktop.
Save generatepress/6a9ad4e007ae0a7388bbbbb7b3ae068f to your computer and use it in GitHub Desktop.
Remove meta links from comments.
if ( ! function_exists( 'generate_comment' ) ) {
/**
* Template for comments and pingbacks.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function generate_comment( $comment, $args, $depth ) {
$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
<div class="comment-body">
<?php _e( 'Pingback:', 'generatepress' ); // WPCS: XSS OK. ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">', '</span>' ); ?>
</div>
<?php else : ?>
<li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?>>
<article id="div-comment-<?php comment_ID(); ?>" class="comment-body" itemscope itemtype="https://schema.org/Comment">
<footer class="comment-meta">
<?php
if ( 0 != $args['avatar_size'] ) {
echo get_avatar( $comment, $args['avatar_size'] );
}
?>
<div class="comment-author-info">
<div class="comment-author vcard" itemprop="author" itemscope itemtype="https://schema.org/Person">
<?php printf( '<cite itemprop="name" class="fn">%s</cite>', get_comment_author() ); ?>
</div><!-- .comment-author -->
<div class="entry-meta comment-metadata">
<time itemprop="datePublished">
<?php printf( // WPCS: XSS OK.
/* translators: 1: date, 2: time */
_x( '%1$s', '1: date, 2: time', 'generatepress' ),
get_comment_date()
); ?>
</time>
<?php edit_comment_link( __( 'Edit', 'generatepress' ), '<span class="edit-link">| ', '</span>' ); ?>
<?php
comment_reply_link( array_merge( $args, array(
'add_below' => 'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '<span class="reply">| ',
'after' => '</span>',
) ) );
?>
</div><!-- .comment-metadata -->
</div><!-- .comment-author-info -->
<?php if ( '0' == $comment->comment_approved ) : ?>
<p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'generatepress' ); // WPCS: XSS OK. ?></p>
<?php endif; ?>
</footer><!-- .comment-meta -->
<div class="comment-content" itemprop="text">
<?php comment_text(); ?>
</div><!-- .comment-content -->
</article><!-- .comment-body -->
<?php
endif;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment