WordPress.org

Make WordPress Core

Ticket #13771: 13771.diff

File 13771.diff, 993 bytes (added by solarissmoke, 7 years ago)
  • wp-includes/general-template.php

     
    13741374 * @since 3.0.0
    13751375 *
    13761376 * @param string $d Optional. PHP date format defaults to the date_format option if not specified.
    1377  * @return string|null Null if displaying, string if retrieving.
     1377 * @param int|object $post Optional post ID or object. Default is global $post object.
     1378 * @return string
    13781379 */
    1379 function get_the_date( $d = '' ) {
    1380         global $post;
    1381         $the_date = '';
    1382 
     1380function get_the_date( $d = '', $post = null ) {
     1381        $post = get_post( $post );
     1382       
    13831383        if ( '' == $d )
    1384                 $the_date .= mysql2date(get_option('date_format'), $post->post_date);
    1385         else
    1386                 $the_date .= mysql2date($d, $post->post_date);
     1384                $d = get_option('date_format');
    13871385
     1386        $the_date = mysql2date( $d, $post->post_date );
     1387
    13881388        return apply_filters('get_the_date', $the_date, $d);
    13891389}
    13901390