Skip to content

Instantly share code, notes, and snippets.

@ammist
Created July 27, 2013 22:38
Show Gist options
  • Save ammist/6096570 to your computer and use it in GitHub Desktop.
Save ammist/6096570 to your computer and use it in GitHub Desktop.
Genesis Comment Hacking - change the time and date. You can put this in your functions.php file. If you do this, your comments will show a relative date (e.g. posted 10 days ago). The original genesis code is in the /genesis/lib/structure/comments.php file.
function my_comment_listing($comment, $args, $depth){
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<?php do_action( 'genesis_before_comment' ); ?>
<div class="comment-header">
<div class="comment-author vcard">
<?php echo get_avatar( $comment, $size = $args['avatar_size'] ); ?>
<?php printf( __( '<cite class="fn">%s</cite> <span class="says">%s:</span>', 'genesis' ), get_comment_author_link(), apply_filters( 'comment_author_says_text', __( 'says', 'genesis' ) ) ); ?>
</div><!-- end .comment-author -->
<div class="comment-meta commentmetadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
<?php echo human_time_diff( get_comment_time('U'), current_time('timestamp') ) . ' ago';?>
<!-- <?php printf( __( '%1$s at %2$s', 'genesis' ), get_comment_date(), get_comment_time() ); ?>--></a>
<?php edit_comment_link( __( '(Edit)', 'genesis' ), '' ); ?>
</div><!-- end .comment-meta -->
</div>
<div class="comment-content">
<?php if ( $comment->comment_approved == '0' ) : ?>
<p class="alert"><?php echo apply_filters( 'genesis_comment_awaiting_moderation', __( 'Your comment is awaiting moderation.', 'genesis' ) ); ?></p>
<?php endif; ?>
<?php comment_text(); ?>
</div><!-- end .comment-content -->
<div class="reply">
<?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
</div>
<?php do_action( 'genesis_after_comment' );
/** No ending </li> tag because of comment threading */
}
add_filter('genesis_comment_list_args', 'my_comment_filter');
function my_comment_filter($args){
$args['callback'] = 'my_comment_listing';
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment