Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7488771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:01:50+00:00 2026-05-29T15:01:50+00:00

The code below is the comments template from my functions.php in WP. It outputs

  • 0

The code below is the comments template from my functions.php in WP. It outputs comments with a reply link to every comment. When someone replies to a comment it says

“In reply to Name of comment author + Comment date”

below the comment text. Clicking that link, which I for simplicity’s sake call the “comment-reply-link”, gets you back to the original comment. So far all is well.

The date of every comment displays correctly in the format I have chosen (‘M j Y H:i’), which is in the first printf function. A comment date will display in the following format “Feb 10 2012 10:35” The date in the “comment-reply-link”, however, displays in a completely different date format: 2012-02-10 10:35:17. As you can see, it also displays seconds.

The last printf function in the code below outputs the “comment-reply-link”. I don’t know where the inconsistent format comes from. It’s not in my settings in the admin panel nor can I find it in the comments-template.php. The only place where the incorrect format is also displayed is in the comment_date column in the comments table when I open the database in phpmyadmin.

Would be very grateful if someone could help me get the “comment-reply-link” in the same date format as the comments themselves (‘M j Y H:i’).

function mytheme_comment( $comment, $args, $depth ) {
        $GLOBALS['comment'] = $comment;
        switch ( $comment->comment_type ) :
            case '' :
        ?>
        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
            <div id="comment-<?php comment_ID(); ?>">
            <div class="comment-body">
            <div class="comment-meta commentmetadata">
            <div class="commenter-info"><span class="commenter"><?php printf( __( '%s', 'mytheme' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?><br/></span><!-- commenter -->
            <div class="comment-date"><?php
                    /* translators: 1: date, 2: time */
                    printf( __( '%1$s', 'mytheme' ), get_comment_date('M j Y H:i') ); ?><?php edit_comment_link( __( 'Edit &rarr;', 'mytheme' ), ' ' );
                ?></div><!-- comment-date -->
            </div><!-- commenter-info -->
            <div class="comment-gravatar"><?php echo get_avatar( $comment, 65 ); ?></div>
            <span class="reply">
                <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
                <a class="comment-reply-link" href="?replytocom=<?php comment_ID(); ?>#respond" onclick="return addComment.moveForm('comment-<?php comment_ID(); ?>', '<?php comment_ID(); ?>', 'respond', '<?php echo $post->ID; ?>')">Reply</a>

            </span><!-- reply -->
                    </div><!-- .comment-meta .commentmetadata -->
                    <div class="comment-content">
            <?php comment_text(); ?>
            </div><!-- comment-content -->
            <?php
            if ( $comment->comment_parent ) {
            $parent = get_comment( $comment->comment_parent );
            $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
            printf( '<span id="replyto">In reply to <a href="%1$s">%2$s %3$s</a></span>', $parent_link, $parent->comment_author, $parent->comment_date );
            } ?>
            <?php if ( $comment->comment_approved == '0' ) : ?>
            <p class="moderation"><?php _e( 'Your comment is moderated', 'mytheme' ); ?></p>
            <?php endif; ?>

            </div><!-- comment-body-->
            </div><!-- #comment-##  -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:01:52+00:00Added an answer on May 29, 2026 at 3:01 pm

    It looks like you need to reformat the $parent->comment_date.

    Try adding this:

    $date = DateTime::createFromFormat( 'Y-m-d H:i:s', $parent->comment_date);
    $parent->comment_date = $date->format( 'M j Y H:i');
    

    Before:

    printf( '<span id="replyto">In reply to <a href="%1$s">%2$s %3$s</a></span>', $parent_link, $parent->comment_author, $parent->comment_date );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code below prints out all comments for a given submissionid in chronological order.
The code below works. But if I comment out the line Dim objRequest As
So in the code below you'll notice the comment // This item is obfuscated
I have the following code which throws an exception (detail in code comments below).
I am using the code below to get information from a database and make
The code below was copied from Bruce Eckel's Thinking in C++ Volume 2 Chapter
In the code below, C's base class B1's template argument OFFSET depends on B0,
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code below is not working as expected to detect if it is in design
Code below is working well as long as I have class ClassSameAssembly in same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.