[wp-hackers] Move Comment JavaScript and Comment Metadata Display

Andrew Nacin wp at andrewnacin.com
Tue Jan 12 08:35:37 UTC 2010


>
> Is there a way to use the functionality of threaded comments without

having to actually move the comment form when clicking on the "Reply"

link below a comment?


Unenqueing the comment-reply.js script will prevent that functionality.

I was also hoping that I could format the display of the comment

metadata specifically the date posted.  However, on line 1285 of

comment-template.php the word "at" is hard coded in echoing of the

date/time. Can that be removed?


The "at" is in Walker_Comment::start_el(). The complex route would be that
you can write your own callback to deal with walking through comments. You
could even extend Walker_Comment and simply replace start_el().

Though I wouldn't recommend the following, technically speaking the text
isn't hard-coded and you could edit it using the gettext filter. (This text
passes through the __() function, which is an alias for translate(), which
applies the filter.) This happens to be the only instance of the "%1$s at
%2$s" string in core. So you can do a hack like this:

add_filter( 'gettext', 'remove_at_from_comment_walker', 10, 2 );
function remove_at_from_comment_walker( $translated, $text ) {
   if ( '%1$s at %2$s' == $text )
      return '%1$s %2$s';
}


More information about the wp-hackers mailing list