Skip to content

Instantly share code, notes, and snippets.

@rfmeier
Last active December 18, 2015 01:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rfmeier/5705978 to your computer and use it in GitHub Desktop.
Save rfmeier/5705978 to your computer and use it in GitHub Desktop.
Remove comment date link in comment meta within Genesis Framework
<?php
add_filter( 'genesis_comment_list_args', 'custom_genesis_comment_list_args' );
/**
* Callback for Genesis 'genesis_comment_list_args' filter.
*
* Override the comment callback and implement custom comment.
*
* @package Genesis
* @category comments
* @author Ryan Meier <rfmeier@gmail.com>
*
* @link http://codex.wordpress.org/Function_Reference/wp_list_comments
*
* @param array $args arguments for wp_list_comments()
* @return array $args arguments for wp_list_comments()
*/
function custom_genesis_comment_list_args( $args ){
// set out custom function
$args['callback'] = 'custom_genesis_comment_callback';
// return the arguments
return $args;
}
/**
* Custom callback for WordPress wp_list_comments() argument
*
* Still using the default Genesis comment conent, remove the link for the
* comment date.
*
* @package Genesis
* @category comments
* @author Ryan Meier <rfmeier@gmail.com>
*
* @link http://codex.wordpress.org/Function_Reference/wp_list_comments
*
* @param object $comment current comment object
* @param array $args arguments for the comment
* @param int $depth depth of replies
*/
function custom_genesis_comment_callback( $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">
<?php //** Comment date removed ** ?>
<span><?php printf( __( '%1$s at %2$s', 'genesis' ), get_comment_date(), get_comment_time() ); ?></span>
<?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 */
}
@blogprofis
Copy link

That worked great, thanks!

@paaljoachim
Copy link

Hey

Do you have a simpler and shorter update to your code?

I just received the following question for this article:
http://easywebdesigntutorials.com/customizing-comments-section-in-wordpress

"Hi, I want to show only day, month and year in the comment meta, without a link and time stamp. Can you tell me how to do that? Thanks for the tutorials."

It would be great if you could help to add another nice and short code snippet similar to the other comment code snippets. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment