| @@ -20,9 +20,17 @@ | ||
| 20 | 20 | |
| 21 | 21 | $post_ID = $block->context['postId']; |
| 22 | 22 | $align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}"; |
| 23 | 23 | $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); |
| 24 | - $formatted_date = get_the_date( isset( $attributes['format'] ) ? $attributes['format'] : '', $post_ID ); | |
| 24 | + | |
| 25 | + if ( isset( $attributes['displayType'] ) && 'modified' === $attributes['displayType'] ) { | |
| 26 | + $formatted_date = get_the_modified_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); | |
| 27 | + $unformatted_date = esc_attr( get_the_modified_date( 'c', $post_ID ) ); | |
| 28 | + } else { | |
| 29 | + $formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); | |
| 30 | + $unformatted_date = esc_attr( get_the_date( 'c', $post_ID ) ); | |
| 31 | + } | |
| 32 | + | |
| 25 | 33 | if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { |
| 26 | 34 | $formatted_date = sprintf( '<a href="%1s">%2s</a>', get_the_permalink( $post_ID ), $formatted_date ); |
| 27 | 35 | } |
| 28 | 36 | |
| @@ -28,9 +36,9 @@ | ||
| 28 | 36 | |
| 29 | 37 | return sprintf( |
| 30 | 38 | '<div %1$s><time datetime="%2$s">%3$s</time></div>', |
| 31 | 39 | $wrapper_attributes, |
| 32 | - esc_attr( get_the_date( 'c', $post_ID ) ), | |
| 40 | + $unformatted_date, | |
| 33 | 41 | $formatted_date |
| 34 | 42 | ); |
| 35 | 43 | } |
| 36 | 44 | |