functions.php 에 아래 코드 그대로 복붙해서 추가
(차일드테마를 추가한 후 활성화 시킨 상태에서 테마디자인-테마편집기 접속)
테마 : generatepress
글이 수정되지 않았다면 원래 그대로 발행일만 표시
원래 내용에서 업데이트 되었으면, 업데이트 문구 + “Updated”을 붙여서 수정일로 표시
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated : %4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
return sprintf( '<span class="posted-on">%s</span> ',
$time_string
);
}, 10, 2 );