Modify comment date

Community Forums Forums General Discussion Modify comment date

This topic is: not resolved

Tagged: 

This topic contains 2 replies, has 3 voices, and was last updated by  essaysnark 1 year, 4 months ago.

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

    gabk77
    Participant
    Post count: 1

    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 :-)

    #41191

    Vajrasar Goswami
    Participant
    Post count: 158

    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.


    Twitter – Vajrasar

    #41285

    essaysnark
    Participant
    Post count: 342

    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 */
    .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.com/forums/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.

    [php]
    /****************************************************/
    /* 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;
    }
    [/php]

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.