Custom Layouts으로 만든 목록, 그리드의 시간이 맞지 않지 않습니다.
해결방법
워드프레스의 시간대가 서울로 설정된 경우, 9시간이 추가되는 오류가 있습니다. 아래 코드를 이용해 해당 오류를 보정할 수 있습니다.
<?php add_shortcode('custom_layout_date', function( $atts ){ global $post; // Y년 m월 d일 $atts = shortcode_atts( array( 'date_format' => 'Y년 F j일', ), $atts ); if( !isset( $post->post_date) || empty($post->post_date )){ return ''; } $date = date_i18n( $atts['date_format'], strtotime( $post->post_date ) ); return $date; });
0개의 댓글