ตอบกลับไปยัง: สอบถามโค๊ต เวลา ใน seed 2 ครับ

#253643
วี ค๊าฟวี ค๊าฟ
Participant
function get_post_time( $format = 'U', $gmt = false, $post = null, $translate = false ) {
    $post = get_post( $post );
 
    if ( ! $post ) {
        return false;
    }
 
    $source   = ( $gmt ) ? 'gmt' : 'local';
    $datetime = get_post_datetime( $post, 'date', $source );
 
    if ( false === $datetime ) {
        return false;
    }
 
    if ( 'U' === $format || 'G' === $format ) {
        $time = $datetime->getTimestamp();
 
        // Returns a sum of timestamp with timezone offset. Ideally should never be used.
        if ( ! $gmt ) {
            $time += $datetime->getOffset();
        }
    } elseif ( $translate ) {
        $time = wp_date( $format, $datetime->getTimestamp(), $gmt ? new DateTimeZone( 'UTC' ) : null );
    } else {
        if ( $gmt ) {
            $datetime = $datetime->setTimezone( new DateTimeZone( 'UTC' ) );
        }
 
        $time = $datetime->format( $format );
    }
 
    /**
     * Filters the localized time a post was written.
     *
     * @since 2.6.0
     *
     * @param string $time   The formatted time.
     * @param string $format Format to use for retrieving the time the post was written.
     *                       Accepts 'G', 'U', or PHP date format. Default 'U'.
     * @param bool   $gmt    Whether to retrieve the GMT time. Default false.
     */
    return apply_filters( 'get_post_time', $time, $format, $gmt );
}

 

คือผมเพิ่ม ฟั่งชั่นนี้เข้าไปเลยใช่ไหมครับ