Make WordPress Core

Ticket #17525: 17525.patch

File 17525.patch, 5.1 KB (added by gauravmittal1995, 9 years ago)

Made a option to select the type of date/time display and changed it accordingly in comment-template

  • wp-includes/comment-template.php

     
    17981798
    17991799                <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
    18001800                        <?php
    1801                                 /* translators: 1: date, 2: time */
    1802                                 printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     1801                                if ( get_option('datetime_format') == 0 ) {
     1802                                        printf( __( '%1$s , %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     1803                                }
     1804                                elseif ( get_option('datetime_format') == 1 ) {
     1805                                        printf( __( '%1$s , %2$s' ), get_comment_time(),  get_comment_date() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     1806                                }                               
     1807                                elseif ( get_option('datetime_format') == 2 ) {
     1808                                        printf( __( '%1$s , %2$s' ), get_comment_date(),  get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     1809                                }                               
     1810                                else {
     1811                                        printf( __( '%1$s , %2$s' ), get_comment_time(),  get_comment_date() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
     1812                                }                               
    18031813                        ?>
    18041814                </div>
    18051815
     
    18401850                                        <div class="comment-metadata">
    18411851                                                <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
    18421852                                                        <time datetime="<?php comment_time( 'c' ); ?>">
    1843                                                                 <?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
     1853                                                                <?php
     1854                                                                        if( get_option('datetime_format') == 0 )
     1855                                                                                printf( _x( '%1$s , %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() );
     1856                                                                        elseif( get_option('datetime_format') == 1 )
     1857                                                                                printf( _x( '%1$s , %2$s', '1: time, 2: date' ), get_comment_time(), get_comment_date() );
     1858                                                                        elseif( get_option('datetime_format') == 2 )
     1859                                                                                printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() );
     1860                                                                        else
     1861                                                                                printf( _x( '%1$s on %2$s', '1: time, 2: date' ), get_comment_time(), get_comment_date() );
     1862                                                                ?>
    18441863                                                        </time>
    18451864                                                </a>
    18461865                                                <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
  • wp-admin/options.php

     
    7070        wp_die(__('Cheatin&#8217; uh?'));
    7171
    7272$whitelist_options = array(
    73         'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
     73        'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'datetime_format', 'start_of_week', 'timezone_string' ),
    7474        'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
    7575        'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
    7676        'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
  • wp-admin/options-general.php

     
    290290</td>
    291291</tr>
    292292<tr>
     293<th scope="row"><label for="datetime_format"><?php _e('Date/Time Display Format') ?></label></th>
     294<td><select name="datetime_format" id="datetime_format">
     295<?php
     296for ($datetime_index = 0; $datetime_index <= 3; $datetime_index++) :
     297        $selected = (get_option('datetime_format') == $datetime_index) ? 'selected="selected"' : '';
     298        if ( 0 == $datetime_index ) {   
     299                echo "\n\t<option value='" . esc_attr($datetime_index) . "' $selected>" . __("'Date','Time'") . '</option>';
     300        }
     301        elseif ( 1 == $datetime_index ) {       
     302                echo "\n\t<option value='" . esc_attr($datetime_index) . "' $selected>" . __("'Time','Date'") . '</option>';
     303        }       
     304        elseif ( 2 == $datetime_index ) {       
     305                echo "\n\t<option value='" . esc_attr($datetime_index) . "' $selected>" . __("'Date' at 'Time'") . '</option>';
     306        }
     307        else { 
     308                echo "\n\t<option value='" . esc_attr($datetime_index) . "' $selected>" . __("'Time' on 'Date'") . '</option>';
     309        }               
     310endfor;
     311?>
     312</select></td>
     313</tr>
     314<tr>
    293315<th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
    294316<td><select name="start_of_week" id="start_of_week">
    295317<?php