Modify comment date

Community Forums Forums General Discussion Modify comment date

This topic is: not resolved


This topic contains 2 replies, has 3 voices, and was last updated by  essaysnark 2 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #41123


    Hi everyone,

    Currently comments show the date as (an example)
    May 16, 2013 at 12:28 PM

    How do I modify it to be just May 16, 2013?

    Your help is much appreciated :-)



    In a recent project I was searching the same tweak along with many more things. I found nothing and eventually I used this -> [ ] to customize the whole HTML output.

    I make WordPress websites using Genesis Framework.

    WordPress/Genesis Development | Customizations

    • This reply was modified 2 years, 6 months ago by  vajrasar.
    • This reply was modified 2 years, 6 months ago by  vajrasar.


    If 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 */

    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: 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 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’] ) ) ); ?>
    		<?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;
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.