Community Forums › Forums › Archived Forums › General Discussion › Modify comment date
Tagged: comment date
- This topic has 2 replies, 3 voices, and was last updated 10 years, 11 months ago by essaysnark.
-
AuthorPosts
-
May 15, 2013 at 9:18 pm #41123May 16, 2013 at 8:17 am #41191vajrasarMember
In a recent project I was searching the same tweak along with many more things. I found nothing and eventually I used this -> [ http://genesissnippets.com/custom-comments-html-output-with-genesis-framework/Â ] to customize the whole HTML output.
I make WordPress websites using Genesis Framework.
May 16, 2013 at 6:58 pm #41285essaysnarkParticipantIf you want to hide the whole date+time string, then there's a very easy way, in your theme's styles.css file:
`
/* hide datestamp from comments */
.commentmetadata
{
display:none
}
`The drawback is that it also removes the direct comment hyperlink.
Here's the code to just remove the time from your comments while keeping the date and the hyperlink. This code goes in your theme's functions.php file. If you've never edited that file before, then please be very careful - take a backup of the file first, and make sure you know how to FTP into your server so that you can restore that backup in case something goes screwy (one tiny error can bring down your whole site) - apologies for all the warnings if you're an old pro at it! If you're not, I did more of a step-by-step here: http://www.studiopress.community/topic/agency-remove-you-are-here-from-breadcrum/#post-39754 If ou have questions, just ask!
And to the real Genesis experts: If there's an easier way to do this please let me know! I could not find a filter for the comment date/time thing.
/****************************************************/ /* Remove the time from the comment's datestamp */ /* This child function is taken from the Genesis 1.9.2 core file */ /* wp-content/themes/genesis/comments.php */ /****************************************************/ function child_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"> <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"><?php printf( __( '%1$s ', 'genesis' ), get_comment_date() ); ?></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', 'child_comment_list_args'); function child_comment_list_args($args) { $args['callback'] = 'child_comment_callback'; return $args; }
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.