Skip to content

Commit

Permalink
fix (post): use wp_date to format the date with set language (#3247)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arukuen committed Jul 22, 2024
1 parent bbf70f1 commit b28ab2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/block/posts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ function generate_render_item_from_stackable_posts_block( $post, $attributes, $t

// Date.
if ( strpos( $new_template, '!#dateTime!#' ) !== false || strpos( $new_template, '!#date!#' ) !== false ) {
$datetime = date( 'c', strtotime( $post['post_date'] ) );
$datetime = wp_date( 'c', strtotime( $post['post_date'] ) );
$date_format = get_option( 'date_format' );
if ( empty( $date_format ) ) {
$date_format = 'F j, Y';
}
$date = date( $date_format, strtotime( $post['post_date'] ) );
$date = wp_date( $date_format, strtotime( $post['post_date'] ) );
$new_template = str_replace( '!#dateTime!#', $datetime, $new_template );
$new_template = str_replace( '!#date!#', $date, $new_template );
}
Expand Down

0 comments on commit b28ab2d

Please sign in to comment.