Make WordPress Core


Ignore:
Timestamp:
09/24/2015 05:26:54 PM (11 years ago)
Author:
wonderboymusic
Message:

Comments: add date column to WP_Comments_List_Table to allow sorting and to break out the date/time from the comment content column.

Props jshreve.
Fixes #15520.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r34424 r34504  
    400400                }
    401401
     402                $columns['date'] = _x( 'Submitted On', 'column name' );
     403
    402404                return $columns;
    403405        }
     
    410412                return array(
    411413                        'author'   => 'comment_author',
    412                         'response' => 'comment_post_ID'
     414                        'response' => 'comment_post_ID',
     415                        'date'     => 'comment_date'
    413416                );
    414417        }
     
    622625         */
    623626        public function column_comment( $comment ) {
    624                 $comment_url = esc_url( get_comment_link( $comment ) );
    625 
    626627                echo '<div class="comment-author">';
    627628                        $this->column_author( $comment );
    628629                echo '</div>';
    629 
    630                 echo '<div class="submitted-on">';
    631                 /* translators: 2: comment date, 3: comment time */
    632                 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
    633                         /* translators: comment date format. See http://php.net/date */
    634                         get_comment_date( __( 'Y/m/d' ), $comment ),
    635                         get_comment_date( get_option( 'time_format' ), $comment )
    636                 );
    637630
    638631                if ( $comment->comment_parent ) {
     
    643636                                printf(
    644637                                        /* translators: %s: comment link */
    645                                         ' | ' . __( 'In reply to %s.' ),
     638                                        __( 'In reply to %s.' ),
    646639                                        '<a href="' . $parent_link . '">' . $name . '</a>'
    647640                                );
     
    649642                }
    650643
    651                 echo '</div>';
    652644                comment_text( $comment );
    653645                if ( $this->user_can ) { ?>
     
    709701
    710702        /**
    711          *
    712          * @return string
     703         * @access public
    713704         */
    714705        public function column_date( $comment ) {
    715                 return get_comment_date( __( 'Y/m/d \a\t g:i a' ), $comment );
     706                $comment_url = esc_url( get_comment_link( $comment ) );
     707                echo '<div class="submitted-on">';
     708                /* translators: 2: comment date, 3: comment time */
     709                printf( __( '<a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
     710                        /* translators: comment date format. See http://php.net/date */
     711                        get_comment_date( __( 'Y/m/d' ), $comment ),
     712                        get_comment_date( get_option( 'time_format' ), $comment )
     713                );
     714                echo '</div>';
    716715        }
    717716
Note: See TracChangeset for help on using the changeset viewer.