Note that there are some explanatory texts on larger screens.

plurals
  1. POInconsistent date format in comments and comment reply link in Wordpress
    text
    copied!<p>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 </p> <p>"In reply to <a href="http://www.">Name of comment author + Comment date</a>" </p> <p>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. </p> <p>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.</p> <p>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.</p> <p>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').</p> <pre><code>function mytheme_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment-&gt;comment_type ) : case '' : ?&gt; &lt;li &lt;?php comment_class(); ?&gt; id="li-comment-&lt;?php comment_ID(); ?&gt;"&gt; &lt;div id="comment-&lt;?php comment_ID(); ?&gt;"&gt; &lt;div class="comment-body"&gt; &lt;div class="comment-meta commentmetadata"&gt; &lt;div class="commenter-info"&gt;&lt;span class="commenter"&gt;&lt;?php printf( __( '%s', 'mytheme' ), sprintf( '&lt;cite class="fn"&gt;%s&lt;/cite&gt;', get_comment_author_link() ) ); ?&gt;&lt;br/&gt;&lt;/span&gt;&lt;!-- commenter --&gt; &lt;div class="comment-date"&gt;&lt;?php /* translators: 1: date, 2: time */ printf( __( '%1$s', 'mytheme' ), get_comment_date('M j Y H:i') ); ?&gt;&lt;?php edit_comment_link( __( 'Edit &amp;rarr;', 'mytheme' ), ' ' ); ?&gt;&lt;/div&gt;&lt;!-- comment-date --&gt; &lt;/div&gt;&lt;!-- commenter-info --&gt; &lt;div class="comment-gravatar"&gt;&lt;?php echo get_avatar( $comment, 65 ); ?&gt;&lt;/div&gt; &lt;span class="reply"&gt; &lt;?php comment_reply_link( array_merge( $args, array( 'depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth'] ) ) ); ?&gt; &lt;a class="comment-reply-link" href="?replytocom=&lt;?php comment_ID(); ?&gt;#respond" onclick="return addComment.moveForm('comment-&lt;?php comment_ID(); ?&gt;', '&lt;?php comment_ID(); ?&gt;', 'respond', '&lt;?php echo $post-&gt;ID; ?&gt;')"&gt;Reply&lt;/a&gt; &lt;/span&gt;&lt;!-- reply --&gt; &lt;/div&gt;&lt;!-- .comment-meta .commentmetadata --&gt; &lt;div class="comment-content"&gt; &lt;?php comment_text(); ?&gt; &lt;/div&gt;&lt;!-- comment-content --&gt; &lt;?php if ( $comment-&gt;comment_parent ) { $parent = get_comment( $comment-&gt;comment_parent ); $parent_link = esc_url( get_comment_link( $comment-&gt;comment_parent ) ); printf( '&lt;span id="replyto"&gt;In reply to &lt;a href="%1$s"&gt;%2$s %3$s&lt;/a&gt;&lt;/span&gt;', $parent_link, $parent-&gt;comment_author, $parent-&gt;comment_date ); } ?&gt; &lt;?php if ( $comment-&gt;comment_approved == '0' ) : ?&gt; &lt;p class="moderation"&gt;&lt;?php _e( 'Your comment is moderated', 'mytheme' ); ?&gt;&lt;/p&gt; &lt;?php endif; ?&gt; &lt;/div&gt;&lt;!-- comment-body--&gt; &lt;/div&gt;&lt;!-- #comment-## --&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload