Skip to content

Instantly share code, notes, and snippets.

@mjsdiaz
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjsdiaz/4ec4441bfe34613e8042 to your computer and use it in GitHub Desktop.
Save mjsdiaz/4ec4441bfe34613e8042 to your computer and use it in GitHub Desktop.
Edit genesis_html5_comment_callback to show only date with no time or link
<?php
//* Remove the line above when copying to your functions.php
add_filter( 'genesis_comment_list_args', 'custom_comment_list_args' );
//* Filter the genesis_comment_list_args to add a custom callback function
function custom_comment_list_args( $args ) {
$args['callback'] = 'custom_comment_callback_no_date';
return $args;
}
function custom_comment_callback_no_date( $comment, array $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<article <?php echo genesis_attr( 'comment' ); ?>>
<?php do_action( 'genesis_before_comment' ); ?>
<header <?php echo genesis_attr( 'comment-header' ); ?>>
<p <?php echo genesis_attr( 'comment-author' ); ?>>
<?php
echo get_avatar( $comment, $args['avatar_size'] );
$author = get_comment_author();
$url = get_comment_author_url();
if ( ! empty( $url ) && 'http://' !== $url ) {
$author = sprintf( '<a href="%s" %s>%s</a>', esc_url( $url ), genesis_attr( 'comment-author-link' ), $author );
}
/**
* Filter the "comment author says" text.
*
* Allows developer to filter the "comment author says" text so it can say something different, or nothing at all.
*
* @since unknown
*
* @param string $text Comment author says text.
*/
$comment_author_says_text = apply_filters( 'comment_author_says_text', __( 'says', 'genesis' ) );
printf( '<span itemprop="name">%s</span> <span class="says">%s</span>', $author, $comment_author_says_text );
?>
</p>
<p <?php echo genesis_attr( 'comment-meta' ); ?>>
<?php
printf( '<time %s>', genesis_attr( 'comment-time' ) );
echo esc_html( get_comment_date() );
echo '</time>';
edit_comment_link( __( '(Edit)', 'genesis' ), ' ' );
?>
</p>
</header>
<div <?php echo genesis_attr( 'comment-content' ); ?>>
<?php if ( ! $comment->comment_approved ) : ?>
<?php
/**
* Filter the "comment awaiting moderation" text.
*
* Allows developer to filter the "comment awaiting moderation" text so it can say something different, or nothing at all.
*
* @since unknown
*
* @param string $text Comment awaiting moderation text.
*/
$comment_awaiting_moderation_text = apply_filters( 'genesis_comment_awaiting_moderation', __( 'Your comment is awaiting moderation.', 'genesis' ) );
?>
<p class="alert"><?php echo $comment_awaiting_moderation_text; ?></p>
<?php endif; ?>
<?php comment_text(); ?>
</div>
<?php
comment_reply_link( array_merge( $args, array(
'depth' => $depth,
'before' => sprintf( '<div %s>', genesis_attr( 'comment-reply' ) ),
'after' => '</div>',
) ) );
?>
<?php do_action( 'genesis_after_comment' ); ?>
</article>
<?php
//* No ending </li> tag because of comment threading
}
Use /wp-content/themes/genesis/lib/structure/comments.php to start your edits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment